#P5809. 【模板】多项式复合逆

    ID: 6567 远端评测题 2500ms 512MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>数学O2优化快速傅里叶变换 FFT快速数论变换 NTT

【模板】多项式复合逆

Background

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

Problem Description

Let F(x)=i=0n1aixiF(x)=\sum\limits _{i=0}^{n-1} a_ix^i be a degree n1n-1 polynomial.

Given nn and the coefficients of F(x)F(x), find a degree n1n-1 polynomial G(x)G(x) such that:

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

Output the coefficients of G(x)G(x) modulo 998244353998244353.

It is guaranteed that a0=0a_0=0 and a10a_1\neq 0.

Input Format

The first line contains a positive integer nn.

The second line contains nn non-negative integers a0,a1,a2,,an1a_0,a_1,a_2,\ldots,a_{n-1}, where aia_i is the coefficient of the ii-th term of F(x)F(x). It is guaranteed that a0=0a_0=0 and a10a_1\neq 0.

Output Format

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

6
0 1 2 2 4 3

0 1 998244351 6 998244329 113

7
0 1 1 4 5 1 4

0 1 998244352 998244351 10 7 998244202

Hint

For 100%100\% of the testdata, 2n2142\leq n\leq 2^{14} and 0ai<998,244,3530\leq a_i < 998,244,353.

Translated by ChatGPT 5