#P17152. [ICPC 2017 Xi'an R] Sum of xor sum
[ICPC 2017 Xi'an R] Sum of xor sum
Problem Description
Song Zha Zha has an -indexed array . Li Zha Zha has queries. Each query has two integers , , asking Ran Zha Zha to do the following thing: First, find all subintervals of . Then calculate their XOR sum. For example:
, , .
All subintervals of are . Their XOR sum is $1 + 2 + 3 + (1 \oplus 2)+ (2 \oplus 3) + (1 \oplus 2 \oplus 3)$.
XOR means exclusive or (^ in C++ or Java).
Input Format
The input contains multiple test cases.
First line contains an integer , which is the number of test cases.
In each test case:
The first line contains two integers , . . is the length of the array .
Then one line contains integers indicating . .
Then lines follow. Each line has two integers , meaning that there’s a query . .
Output Format
For each query, print the answer mod .
1
3 1
1 2 3
1 3
10