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

建议使用的浏览器:

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

6589:Sequence

题目描述
Tom gets an integer sequence $a$ indexed from $1$ with length $n$ from Jerry and he wants to apply $k$ kinds of operations to this sequence.
For a type $k$ operation, he calculates $b_i = \sum_{j = i - k \cdot x} a_j (0 \leq x, 1\leq j \leq i)$ for every $i$ ranged from $1$ to $n$ and then replaces each $a_i$ with $b_i\bmod 998244353$.
He wonders what the final sequence looks like after $m$ operations.
输入解释
The first line contains an integer $T(T \leq 10)$, denoting the number of testcases.
For each test case, the first line contains two integers $n$ and $m(1 \leq n \leq 10 ^ 5, 1\leq m \leq 10^6 )$, representing the length of sequence $a$ and the number of operations.
The following line contains $n$ integers denoting the sequence $a(1\leq a_i\leq 10^9)$.
The last line contains $m$ integers representing the sequence of operations. Let $c_i$ be the $i$th number in this sequence, it means the type of $i$th operation is $c_i(1\leq c_i \leq 3)$.
It is guaranteed that $\sum n \leq 2.1 \times 10^5, \sum m \leq 2.1 \times 10^6 $.
输出解释
For each test case, output one line containing an integer $ans$.
$ans = (1 \cdot a_1) \oplus (2 \cdot a_2) \oplus...\oplus(n \cdot a_n)$, $a_i$ is the $i$th element of sequence $a$ after $m$ operations, $\oplus$ means bitwise exclusive OR operation.
输入样例
2
5 2
2 4 2 1 1
1 1
5 2
3 2 2 4 1
2 2
输出样例
233
121
来自杭电HDUOJ的附加信息
Recommend

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

源链接: HDU-6589

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

共提交 0

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