atcoder#ABC137F. [ABC137F] Polynomial Construction
[ABC137F] Polynomial Construction
Score : points
Problem Statement
Given are a prime number and a sequence of integers consisting of zeros and ones.
Find a polynomial of degree at most , $f(x) = b_{p-1} x^{p-1} + b_{p-2} x^{p-2} + \ldots + b_0$, satisfying the following conditions:
- For each , is an integer such that .
- For each , .
Constraints
- is a prime number.
Input
Input is given from Standard Input in the following format:
Output
Print of a polynomial satisfying the conditions, in this order, with spaces in between.
It can be proved that a solution always exists. If multiple solutions exist, any of them will be accepted.
2
1 0
1 1
satisfies the conditions, as follows:
3
0 0 0
0 0 0
is also valid.
5
0 1 0 1 0
0 2 0 1 3