#P6097. 【模板】子集卷积
【模板】子集卷积
Description
Given two sequences of length , and , you need to compute a sequence , where satisfies:
$$c_k=\sum_{\substack{{i \& j=0}\\{i~\mid~ j=k}}} a_i b_j$$Here, denotes bitwise OR, and denotes bitwise AND.
The answer should be taken modulo .
Input Format
The first line contains a positive integer , representing the size of the set.
The second line contains integers, describing .
The third line contains integers, describing .
Output Format
Output one line with integers, representing .
2
1 0 2 1
2 0 2 1
2 0 6 3
Hint
For all testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号