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

建议使用的浏览器:

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

6356:Glad You Came

题目描述
Steve has an integer array $a$ of length $n$ (1-based). He assigned all the elements as zero at the beginning. After that, he made $m$ operations, each of which is to update an interval of $a$ with some value. You need to figure out $\bigoplus_{i = 1}^{n}{(i \cdot a_i)}$ after all his operations are finished, where $\bigoplus$ means the bitwise exclusive-OR operator.
In order to avoid huge input data, these operations are encrypted through some particular approach.
There are three unsigned 32-bit integers $X, Y$ and $Z$ which have initial values given by the input. A random number generator function is described as following, where $\wedge$ means the bitwise exclusive-OR operator, $< <$ means the bitwise left shift operator and $> >$ means the bitwise right shift operator. Note that function would change the values of $X, Y$ and $Z$ after calling.

Let the $i$-th result value of calling the above function as $f_i$ $(i = 1, 2, \cdots, 3 m)$. The $i$-th operation of Steve is to update $a_j$ as $v_i$ if $a_j < v_i$ $(j = l_i, l_i + 1, \cdots, r_i)$, where
$$\begin{cases} l_i &= \min\left((f_{3 i - 2} \bmod n) + 1, (f_{3 i - 1} \bmod n) + 1\right) \\ r_i &= \max\left((f_{3 i - 2} \bmod n) + 1, (f_{3 i - 1} \bmod n) + 1\right) \\ v_i &= f_{3 i} \bmod 2^{30}\end{cases} (i = 1, 2, \cdots, m).$$
输入解释
The first line contains one integer $T$, indicating the number of test cases.
Each of the following $T$ lines describes a test case and contains five space-separated integers $n, m, X, Y$ and $Z$.
$1 \leq T \leq 100$, $1 \leq n \leq 10^5$, $1 \leq m \leq 5 \cdot 10^6$, $0 \leq X, Y, Z < 2^{30}$.
It is guaranteed that the sum of $n$ in all the test cases does not exceed $10^6$ and the sum of $m$ in all the test cases does not exceed $5 \cdot 10^7$.
输出解释
For each test case, output the answer in one line.
输入样例
4
1 10 100 1000 10000
10 100 1000 10000 100000
100 1000 10000 100000 1000000
1000 10000 100000 1000000 10000000
输出样例
1031463378
1446334207
351511856
47320301347

提示
In the first sample, a = [1031463378] after all the operations.
In the second sample, a = [1036205629, 1064909195, 1044643689, 1062944339, 1062944339, 1062944339, 1062944339, 1057472915, 1057472915, 1030626924] after all the operations.
来自杭电HDUOJ的附加信息
Recommend chendu

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

源链接: HDU-6356

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

共提交 0

通过率 --%
时间上限 内存上限
10000/5000MS(Java/Others) 262144/262144K(Java/Others)