409835: GYM103800 L Ginger's function
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
L. Ginger's functiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
$$$\texttt{Ginger}$$$ has a function
$$$$$$ G(x) = \prod_{i=1}^{n}(1-x^{\lfloor \frac{f_i}{2} \rfloor}-x^{f_i}) $$$$$$
$$$\texttt{Ginger}$$$ decides to give you $$$q$$$ inquiries, given a integer $$$a$$$ for each query, answer the coefficient of $$$x ^ a$$$.
InputThe first line contains two integers $$$n$$$ $$$(1 \le n \le 11)$$$, $$$q$$$ $$$(1 \le q \le 10 ^ 4)$$$.
The second line contains $$$n$$$ integers $$$f_1, f_2, \dots, f_n$$$ $$$(0 \leq f_i \leq 10^6)$$$.
The next $$$q$$$ lines contains a integer $$$a$$$ $$$(0 \leq a \leq \sum_{i = 1} ^ {n} f_i)$$$
Outputoutput $$$q$$$ lines, Each line print the answer.
ExampleInput2 5 3 4 0 1 2 3 5Output
1 -1 -1 0 2Note
For test case:
$$$(1-x-x^3)(1-x^2-x^4) = 1 - x - x^2 - x^4 + 2x^5 + x^7$$$