#P5373. 【模板】多项式复合函数
【模板】多项式复合函数
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\limits_{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 , representing the degrees of and .
The second line contains non-negative integers , representing the coefficient of the term of .
The third line contains non-negative integers , representing the coefficient of the term of .
Output Format
Output one line with non-negative integers, from low degree to high degree, representing the coefficients of .
5 1
1 9 2 6 0 8
1 7
26 497 4900 29498 96040 134456
Hint
Constraints:
Translated by ChatGPT 5
京公网安备 11011102002149号