#P5809. Compositional Inverse of Formal Power Series

    ID: 19037 Type: Default 1000ms 256MiB

Compositional Inverse of Formal Power Series

Compositional Inverse of Formal Power Series

Given a formal power series (polynomial) F(x) of degree n-1 defined as

\( F(x) = \sum_{i=0}^{n-1} a_i x^i \)

with the guarantees that \(a_0 = 0\) and \(a_1 \neq 0\), find the unique formal power series G(x) of degree n-1 satisfying

\( G(F(x)) \equiv x \pmod{x^n} \).

Output the coefficients of \( G(x) \) modulo 998244353.

Note: Since \(a_0=0\) and \(a_1\ne0\), the series \(F(x)\) is invertible (with respect to composition) and the series G(x) is known as the compositional inverse of \(F(x)\).

inputFormat

The first line contains a single integer n (\(n \ge 2\)), which denotes that F(x) is a polynomial of degree n-1.

The second line contains n integers: a0, a1, ..., an-1 where \(a_0 = 0\) and \(a_1 \neq 0\). These represent the coefficients of \(F(x)\) in increasing order of degree.

outputFormat

Output n space‐separated integers, which are the coefficients of G(x) (from degree \(0\) to \(n-1\)) modulo 998244353.

sample

2
0 3
0 332748118

</p>