5346: Convolution
内存限制:512 MB
时间限制:3.000 S
评测方式:文本比较
命题人:
提交:0
解决:0
题目描述
Bob invented a new operation ⊗
Let pi denote the i-th prime number. If x=∏ipiai and y=∏ipibi, then
x⊗y=∏ipi∣ai−bi∣
Now Bob have a sequence a1...n, he wants to calculate sequence b1...n satisfies:
bi=∑1≤j,k≤n,j⊗k=iajkc
The answer may be very large, you only need to output:
(b1mod998244353) xor (b2mod998244353) ... xor (bnmod998244353)
XOR means bitwise exclusive OR
Let pi denote the i-th prime number. If x=∏ipiai and y=∏ipibi, then
x⊗y=∏ipi∣ai−bi∣
Now Bob have a sequence a1...n, he wants to calculate sequence b1...n satisfies:
bi=∑1≤j,k≤n,j⊗k=iajkc
The answer may be very large, you only need to output:
(b1mod998244353) xor (b2mod998244353) ... xor (bnmod998244353)
XOR means bitwise exclusive OR
输入
The first line has two integers n,c.
The second line has n integers a1...n.
1≤n≤106
0≤ai<998244353
0≤c≤109
The second line has n integers a1...n.
1≤n≤106
0≤ai<998244353
0≤c≤109
输出
Output the answer.
样例输入 复制
6 1
1 2 3 4 5 6
样例输出 复制
55