#P5273. Polynomial Exponentiation Modulo xⁿ
Polynomial Exponentiation Modulo xⁿ
Polynomial Exponentiation Modulo xⁿ
You are given a polynomial \(A(x)\) of degree at most \(n-1\) and an integer \(k\). Your task is to compute a polynomial \(B(x)\) such that
\[ B(x) \equiv (A(x))^k \pmod{x^n}, \]
All operations on the coefficients are performed modulo \(998244353\). The polynomial \(A(x)\) is provided in the form of \(n\) coefficients (from degree \(0\) to degree \(n-1\)).
The computed polynomial \(B(x)\) should be output as \(n\) coefficients representing the polynomial modulo \(x^n\).
inputFormat
The first line of input contains two integers \(n\) and \(k\) (where \(n\) is the number of coefficients and \(k\) is the exponent).
The second line contains \(n\) space-separated integers representing the coefficients of \(A(x)\) (from degree 0 to degree \(n-1\)).
outputFormat
Output \(n\) space-separated integers representing the coefficients of \(B(x) = (A(x))^k \pmod{x^n}\), with each coefficient taken modulo \(998244353\).
sample
3 2
1 1 1
1 2 3