P4238 {{[Template] Polynomial Multiplicative Inverse}}

Background

{{Note: This problem is not within the knowledge points designated by the China Computer Federation (CCF) for the Senior track.}}

Description

{{Given a polynomial $F(x)$, find a polynomial $G(x)$ such that $F(x) * G(x) \equiv 1 \pmod{x^n}$. Coefficients are taken modulo 998244353.}}

Input Format

{{First, input an integer $n$, indicating the number of terms of the input polynomial. Then input $n$ integers; the $i$-th integer $a_i$ denotes the coefficient of the term of $F(x)$ with degree $i-1$.}}

Output Format

{{Output $n$ integers; the $i$-th integer $b_i$ denotes the coefficient of the term of $G(x)$ with degree $i-1$. It is guaranteed that a solution exists.}}

Explanation/Hint

{{For $100\%$ of the testdata, $1 \leq n \leq 10^5$, $0 \leq a_i \leq 10^9$.}} Translated by ChatGPT 5