网址:https://nanti.jisuanke.com/t/20755
- 2000ms
- 262144K
Song Zha Zha has an 11-indexed array A . Li Zha Zha has QQ queries . Each query has two integers LL, RR , asking Ran Zha Zha to do the following thing .First , find all subintervals of [L,R][L,R] . Then calculate their xor sum . For example .
A={1,2,3}A=1,2,3 , L=1L=1, R=3R=3.
All subintervals of [1,3][1,3] are [1,1],[2,2],[3,3],[1,2],[2,3],[3,3][1,1],[2,2],[3,3],[1,2],[2,3],[1,3] .Their xor sum = 1 + 2 + 3 + 11+2+3+1 xor 2 + 22+2 xor 3 + 13+1xor 22 xor 33 .
Xor means exclusive or . (^
in C++ or Java )
Input
The input contains multiple test cases.
First line contains an integer TT (1 \le T \le 10)(1≤T≤10) , which is the number of test cases .
In each test case:
The first line contains two integers NN, QQ. (1 \le N,Q \le 100000)(1≤N,Q≤100000) . NN is the length of the array AA .
Then one line contains NN integer indicating A[i]A[i]. (1 \le i \le N , 0 \le A[i] \le 1000000)(1≤i≤N,0≤A[i]≤1000000).
Then QQ lines follow . Each line two integer L,RL,R, means that there’s a query [L,R][L,R] . (1 \le L \le R \le N)(1≤L≤R≤N).
OutputFor each query, print the answer mod 10000000071000000007.
样例输入
1 3 1 1 2 3 1 3
样例输出
10
题目来源
- 2000ms
- 262144K
- 2000ms
- 262144K