#P6613. 一阶微分方程

    ID: 7387 远端评测题 3000ms 256MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>数学O2优化微积分导数快速傅里叶变换 FFT

一阶微分方程

Background

In the problem, the expression on the right side of F(x)F'(x) can be replaced by others. Here it is fixed for easier testing.

Problem Description

Given polynomials F(x)F(x), A(x)A(x), and B(x)B(x) satisfying:

$$\frac{\text dF(x)}{\text dx} \equiv A(x)\text e^{F(x)-1}+B(x) \pmod{x^n}$$

and F(0)=1F(0)=1.

Given A(x)A(x) and B(x)B(x), find the coefficients of the first nn terms of F(x)F(x).

Output the answer modulo 998244353998244353.

Input Format

The first line contains a positive integer nn, representing the degree of A(x)A(x) and B(x)B(x).
The second line contains n+1n+1 integers, from low degree to high degree, representing the coefficients of A(x)A(x).
The third line contains n+1n+1 integers, from low degree to high degree, representing the coefficients of B(x)B(x).

Output Format

Output one line with n+1n+1 integers, from low degree to high degree, representing the coefficients of F(x)F(x).

9
2 9 8 7 3 6 5 4 1 12
23 9 8 7 4 6 1 3 2 5 
1 25 34 332748429 124783260 22560 624092696 904826719 284383572 50973515

Hint

Constraints

For 30%30\% of the testdata, 1n50001 \le n \le 5000.
For 100%100\% of the testdata, 1n1051 \le n \le 10^5.

All inputs are guaranteed to be in the range [0,998244353)[0,998244353).

Translated by ChatGPT 5