计蒜客 ACM-ICPC 2017 Asia Xi'an Sum of xor sum ()

网址: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 LLRR , 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=1R=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)(1T10) , which is the number of test cases .

In each test case:

The first line contains two integers NNQQ(1 \le N,Q \le 100000)(1N,Q100000) . 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)(1iN,0A[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)(1LRN).

OutputFor each query, print the answer mod 10000000071000000007.

样例输入
1
3 1
1 2 3
1 3
样例输出
10
题目来源

ACM-ICPC 2017 Asia Xi'an


  •  2000ms
  •  262144K
  •  2000ms
  •  262144K
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值