#P3803. 【模板】多项式乘法(FFT)

    ID: 2745 远端评测题 2000ms 500MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>递归O2优化向量快速傅里叶变换 FFT

【模板】多项式乘法(FFT)

Description

Given a degree nn polynomial F(x)F(x) and a degree mm polynomial G(x)G(x), compute the product F(x)F(x) and G(x)G(x).

Input Format

The first line contains two integers n,mn, m.

The next line contains n+1n+1 integers, representing the coefficients of F(x)F(x) from lowest degree to highest.

The next line contains m+1m+1 integers, representing the coefficients of G(x)G(x) from lowest degree to highest.

Output Format

Output one line containing n+m+1n+m+1 integers, representing the coefficients of F(x)G(x)F(x) \cdot G(x) from lowest degree to highest.

1 2
1 2
1 2 1
1 4 5 2

Hint

It is guaranteed that all input coefficients are integers between 00 and 99 inclusive.

For 100%100\% of the testdata: 1n,m1061 \le n, m \leq {10}^6.

Translated by ChatGPT 5