1687. Kanade's convolution

时间限制 5000 ms   内存限制 512 MB

Give you two arrays $A[0..2^m-1]$ and $B[0..2^m-1]$.

Please calculate array $C[0..2^m-1]$:

$$C[k]=\sum_{i~and~j=k}A[i~xor~j]*B[i~or~j]$$

You just need to print $\sum_{i=0}^{2^m-1}C[i]*1526^i ~mod~998244353$

$m<=19$

$0\leq A[i],B[i]< 998244353$

输入数据

There is only one test case.

The first line consists of one integer $m$.

The second line consists of $2^m$ integers $A[0..2^m-1]$

The third line consists of $2^m$ integers $B[0..2^m-1]$

输出数据

Output only one integer means the answer.

样例输入

复制
2

1 2 3 4

5 6 7 8 \n
\n
 · · · \n
\n
 · · · \n

样例输出

复制
568535691         \n

提交

请先 登录

Source

2017 Multi-University Training Contest - Team 3

© 2025 FAQs Contact About