P5809 [Template] Polynomial Composition Inverse

Background

Shen Yu (姐姐) is procrastinating too much qwq.

Description

Let $F(x)=\sum\limits _{i=0}^{n-1} a_ix^i$ be a degree $n-1$ polynomial. Given $n$ and the coefficients of $F(x)$, find a degree $n-1$ polynomial $G(x)$ such that: $$ G(F(x))\equiv x\pmod{x^n} $$ Output the coefficients of $G(x)$ modulo $998244353$. It is guaranteed that $a_0=0$ and $a_1\neq 0$.

Input Format

The first line contains a positive integer $n$. The second line contains $n$ non-negative integers $a_0,a_1,a_2,\ldots,a_{n-1}$, where $a_i$ is the coefficient of the $i$-th term of $F(x)$. It is guaranteed that $a_0=0$ and $a_1\neq 0$.

Output Format

Output one line with $n$ non-negative integers. The $i$-th non-negative integer is the coefficient of the $(i-1)$-th term of $G(x)$.

Explanation/Hint

For $100\%$ of the testdata, $2\leq n\leq 2^{14}$ and $0\leq a_i < 998,244,353$. Translated by ChatGPT 5