#P5277. 【模板】多项式开根(加强版)
【模板】多项式开根(加强版)
Background
This is a template problem, with no background.
Problem Description
Given an -degree polynomial , find a polynomial modulo such that .
All polynomial coefficients are computed modulo .
Input Format
The first line contains a positive integer .
The next line contains integers, representing the coefficients in order.
It is not guaranteed that , but it is guaranteed that is a quadratic residue modulo .
Output Format
Output non-negative integers, representing the coefficients of the answer polynomial. If there are multiple solutions, output the one with the smallest lexicographical order of the coefficient sequence (not the character sequence).
3
1 2 1
1 1 0
7
1 8596489 489489 4894 1564 489 35789489
1 503420421 924499237 13354513 217017417 707895465 411020414
Hint
For of the testdata, .
For of the testdata, .
For of the testdata, .
For of the testdata, , and .
Translated by ChatGPT 5