当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5286:wyh2000 and sequence

题目描述
Young theoretical computer scientist wyh2000 is concentrating on studying data structures.

In order to show his wisdom, he gives his students a hard problem.

Wyh2000 gives a sequence $A_1,A_2,\ldots,A_n$.He would ask his students $q$ times,each time he gives $l,r$.Suppose $[l, r]$ have $k$ different numbers $c_1,c_2,\ldots,c_k$,and $c_i$ appears $b_i$ times in the interval $[l, r]$,the students should tell him the value of $\sum_{i=1}^{k}c_i^{b_i}$ modulo $1000000007$,you should use online algorithm.
输入解释
In the first line, there is an integer $T$ indicates the number of test cases.

For each case, the first line contains two integers $n,q$,the second line contains $n$ integers $A_1,A_2,\ldots,A_n$.

In the next $q$ lines,each line contains 2 intergers $a,b$.Query parameters $l,r$ are obtained from the numbers $a,b$.$l=\min((a \oplus la)\%n+1,(b \oplus la)\%n+1),r=\max((a \oplus la)\%n+1,(b \oplus la)\%n+1)$

The $\oplus$ means xor,and $la$ equals the response for the previous query.$la=0$ when each case begin.

$T\leq5,1\leq A_i,a,b\leq10^9$

In the $i$th case,$1\leq n,q\leq i\times10000$
输出解释
Print a response for each query in a separate line.
输入样例
2
5 3
2 1 2 3 1
10 14
9 8
8 7
5 2
2 3 3 2 2
7 4
3 6
输出样例
8
3
6
7
13

提示
In the first case,the inquiry intervals are $[1,5],[1,2],[2,5]$.
In the second case,the inquiry intervals are $[3,5],[2,5]$.
Don't add extra spaces after any line of your hack data.
来自杭电HDUOJ的附加信息
Recommend hujie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5286

最后修改于 2020-10-25T23:21:21+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
6000/3000MS(Java/Others) 262144/131072K(Java/Others)