Problem 2971 --Sequence

2971: Sequence

"
Time Limit $3$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $5$ 正确数量 $2$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签
Tom gets an integer sequence aa indexed from 11 with length nn from Jerry and he wants to apply kk kinds of operations to this sequence. 
For a type kk operation, he calculates bi=∑j=i−k⋅xaj(0≤x,1≤j≤i)bi=∑j=i−k⋅xaj(0≤x,1≤j≤i) for every ii ranged from 11 to nn and then replaces each aiai with bimod998244353bimod998244353
He wonders what the final sequence looks like after mm operations.
The first line contains an integer T(T≤10)T(T≤10), denoting the number of testcases. 
For each test case, the first line contains two integers nn and m(1≤n≤105,1≤m≤106)m(1≤n≤105,1≤m≤106), representing the length of sequence aa and the number of operations. 
The following line contains nn integers denoting the sequence a(1≤ai≤109)a(1≤ai≤109)
The last line contains mm integers representing the sequence of operations. Let cici be the iith number in this sequence, it means the type of iith operation is ci(1≤ci≤3)ci(1≤ci≤3)
It is guaranteed that ∑n≤2.1×105,∑m≤2.1×106∑n≤2.1×105,∑m≤2.1×106.
For each test case, output one line containing an integer ansans
ans=(1⋅a1)⊕(2⋅a2)⊕...⊕(n⋅an)ans=(1⋅a1)⊕(2⋅a2)⊕...⊕(n⋅an)aiai is the iith element of sequence aa after mm operations, ⊕⊕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

推荐代码 查看2971 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$1108 $ms] 刘成健 461300 2019-09-06 17:11:24
内存最少[$34248 $KB] 淡意的温柔 605346 2020-07-03 15:08:45
第一AC 刘成健 461300 2019-09-06 17:11:24
第一挑战 刘成健 461300 2019-09-06 17:11:24

赛题来源/所属竞赛 2019 Multi-University Training Contest 1 N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛