#P10249. 【模板】多项式复合函数(加强版)
【模板】多项式复合函数(加强版)
Background
Compared with P5373, this problem has larger constraints.
Problem Description
Given an -degree polynomial and an -degree polynomial , you need to find an -degree polynomial that satisfies:
In other words, the polynomial you need should satisfy:
$$H(x) \equiv \sum_{i=0}^n [x^i]F(x)\times G(x)^i \space (\text{mod }x^{n+1})$$Take all coefficients of the result modulo .
Input Format
The first line contains two positive integers , which are the degrees of and , respectively.
The second line contains non-negative integers , where is the coefficient of the -th power term of .
The third line contains non-negative integers , where is the coefficient of the -th power term of .
Output Format
Output one line with non-negative integers, representing the coefficients of from low degree to high degree.
4 3
1 2 3 4 5
1 2 3 4
15 80 300 892 2069
Hint
Constraints:
| Test Point ID | |
|---|---|
Translated by ChatGPT 5