Angie and Functions (Hard)

View as PDF

Submit solution

Points: 30
Time limit: 2.0s
Memory limit: 256M

Authors:
Problem types

Angie is studying functions!

For her homework, she was asked to figure out the coefficients c_1, c_2, \dots, c_N, c_{N+1} in the following function:

f(x)=c_1x^N+c_2x^{N-1}+\dots+c_Nx+c_{N+1} (All the coefficients are integers)

Angie has N + 1 arbitrary integer (x, y) coordinate pairs on the polynomial, and wants you to help her find the coefficients.

Can you help her?

Input Specification

The first line of input will be N (1 \le N \le 10^5), the degree number of the polynomial.

The next N + 1 lines will each contain a single coordinate pair (x, y) indicating that f(x) = y.

The x and y values will be given modulo 77\,309\,411\,329, and all x values will be unique.

Output Specification

The output should contain N + 1 integers, the coefficients of the polynomial in descending degree. The coefficients should be output modulo 77\,309\,411\,329.

Sample Input

2
0 0
1 1
2 4

Sample Output

1 0 0

Comments

There are no comments at the moment.