#P10461. 【模板】多项式复合集合幂级数
【模板】多项式复合集合幂级数
Problem Description
Given a set power series and a polynomial , it is guaranteed that . Define the multiplication of as subset convolution. You need to compute, for every , the value of modulo .
If you still do not understand the statement, you can read the hint section at the end.
Input Format
The first line contains a positive integer .
The next line contains non-negative integers. The -th integer denotes , where if and only if, in the binary representation of , the -th bit (from low to high) is .
The next line contains non-negative integers. The -th integer denotes .
Output Format
Output one line containing non-negative integers. The -th integer denotes modulo , where if and only if, in the binary representation of , the -th bit (from low to high) is .
2
0 1 2 3
2 1 1
2 1 2 7
4
0 8 3 2 7 3 9 0 0 1 8 2 3 7 0 2
1 0 4 8 2
1 0 0 192 0 448 168 8824 0 0 0 536 0 248 520 26560
Hint
Constraints
For all testdata, it is guaranteed that , and .
This problem has test points. For the -th test point, .
Hint
Suppose , then .
In this problem, the multiplication of is defined as subset convolution, i.e.:
$$x^S\cdot x^T=\begin{cases}0&S\cap T\neq\varnothing\\x^{S\cup T}&\text{otherwise}\end{cases}$$Please pay attention to the efficiency differences caused by contiguous memory access.
Translated by ChatGPT 5