atcoder#ABC185F. [ABC185F] Range Xor Query
[ABC185F] Range Xor Query
Score : points
Problem Statement
We have an integer sequence of length . You will process queries on this sequence. In the -th query, given values , , and , do the following:
- If , replace with .
- If , print $A_{X_i} \oplus A_{X_i + 1} \oplus A_{X_i + 2} \oplus \dots \oplus A_{Y_i}$.
Here, denotes the bitwise XOR of and .
What is bitwise XOR?
The bitwise XOR of integers and , , is defined as follows:
- When is written in base two, the digit in the 's place () is if either or , but not both, has in the 's place, and otherwise.
For example, . (In base two: .)
Constraints
- is or .
- If , then and .
- If , then .
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
$A_1 \hspace{7pt} A_2 \hspace{7pt} A_3 \hspace{5pt} \dots \hspace{5pt} A_N$
Output
For each query with in the order received, print the response in its own line.
3 4
1 2 3
2 1 3
2 2 3
1 2 3
2 2 3
0
1
2
In the first query, we print . In the second query, we print . In the third query, we replace with . In the fourth query, we print .
10 10
0 5 3 4 7 0 0 0 1 0
1 10 7
2 8 9
2 3 6
2 1 6
2 1 10
1 9 4
1 6 1
1 6 3
1 1 7
2 3 5
1
0
5
3
0