#P8257. [CTS2022] 普罗霍洛夫卡
[CTS2022] 普罗霍洛夫卡
Problem Description
Given a sequence and a total of queries, each query provides . You need to compute the bitwise XOR sum of the weights of all pairs that satisfy . The weight of a pair is .
Input Format
Read from standard input.
The first line contains two integers .
The next line contains integers .
The next lines each contain two integers , representing one query.
Output Format
Write to standard output.
Output lines, in order, each being the answer to the corresponding query.
5 2
1 1 1 2 4
1 5
3 5
3
2
Hint
For of the testdata, .
For of the testdata, .
For of the testdata, .
For of the testdata, .
For of the testdata, .
For of the testdata, .
For another of the testdata, .
For another of the testdata, for all , .
For another of the testdata, for all , .
For of the testdata, , , and all values are integers.
Each category of testdata forms a subtask.
Translated by ChatGPT 5