#P8779. [蓝桥杯 2022 省 A] 推导部分和
[蓝桥杯 2022 省 A] 推导部分和
Problem Description
Given an integer sequence of length , Xiao Lan wants to know the partial sum from index to , i.e., $\sum\limits_{i=l}^{r} A_i = A_{l} + A_{l+1} + \cdots + A_{r}$.
However, Xiao Lan does not know the value of each number in the sequence. He only knows the values of partial sums. The -th partial sum is the sum from index to , i.e., $\sum_{j=l_{i}}^{r_{i}} A_j = A_{l_{i}} + A_{l_{i}+1} + \cdots + A_{r_{i}}$, and its value is .
Input Format
The first line contains integers , representing the array length, the number of known partial sums, and the number of queried partial sums.
The next lines each contain integers .
The next lines each contain integers and , representing a partial sum that Xiao Lan wants to know.
Output Format
For each query, output one line containing one integer as the answer. If the answer cannot be determined, output UNKNOWN.
5 3 3
1 5 15
4 5 9
2 3 5
1 5
1 3
1 2
15
6
UNKNOWN
Hint
For of the test cases, , .
For of the test cases, , .
For of the test cases, , .
For of the test cases, , .
For of the test cases, , .
For all test cases, , , , . The testdata guarantees that there are no contradictions.
Lanqiao Cup 2022 Provincial Contest A Group, Problem J.
Translated by ChatGPT 5