#P10401. 「XSOI-R1」区间操作 (opt)
「XSOI-R1」区间操作 (opt)
Background
Little A likes interval operation problems.
Problem Description
Little A gives you a sequence of length , and queries.
For each query, Little A gives you two positive integers . You need to compute the value of $(a_l) \oplus (a_l+a_{l+1}) \oplus (a_l+a_{l+1}+a_{l+2}) \oplus \dots \oplus (a_l + a_{l+1} + a_{l+2} + \dots + a_r)$.
Here denotes the XOR operation.
Input Format
The first line contains two positive integers .
The next line contains integers .
Then follow lines, each containing two positive integers .
Output Format
Output lines.
Each line contains one integer, representing your answer.
6 1
1 1 4 5 1 4
1 6
18
7 10
1 9 1 9 8 1 0
1 2
1 3
1 4
1 5
1 6
1 7
2 6
3 5
4 7
2 7
11
0
20
8
21
8
23
25
24
11
Hint
[Sample Explanation #1]
$1 \oplus (1 + 1) \oplus (1 + 1 + 4) \oplus (1 + 1 + 4 + 5) \oplus (1 + 1 + 4 + 5 + 1) \oplus (1 + 1 + 4 + 5 + 1 + 4) = 18$.
Constraints and Notes
This problem uses bundled tests.
- Subtask 0 (13 pts): .
- Subtask 1 (28 pts): .
- Subtask 2 (19 pts): .
- Subtask 3 (7 pts): .
- Subtask 4 (17 pts): all are non-negative powers of .
- Subtask 5 (16 pts): no special constraints.
For all testdata, , , .
upd (2024.7.3): Added one set of hack testdata, removed one set of testdata.
Translated by ChatGPT 5