#P17146. [ICPC 2017 Xi'an R] XOR
[ICPC 2017 Xi'an R] XOR
题目描述
Consider an array with elements. Each of its elements is (). Then two integers , are given, and queries follow. For each query, you are given , . You can get by the following rules.
To get , at first you need to choose some elements from to , we call them . Then you can get number or $(A[i_1] \text{ xor } A[i_2] \text{ xor } \dots \text{ xor } A[i_t])$.
Please calculate the maximum for each query.
输入格式
Several test cases.
First line an integer (). Indicates the number of test cases. Then test cases follow. Each test case begins with three integers , , ($1 \le N \le 10000,\ 1 \le Q \le 100000,\ 0 \le K \le 100000$). The next line has integers indicating to (). Then lines follow, each line contains two integers , ().
输出格式
For each query, print the answer in a single line.
1
5 3 0
1 2 3 4 5
1 3
2 4
3 5
3
7
7