#P5488. 差分与前缀和

    ID: 6203 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>数学快速傅里叶变换 FFT快速数论变换 NTT

差分与前缀和

Problem Description

Given a sequence aa of length nn, find its kk-th order difference or prefix sum.
Each term of the result needs to be taken modulo 10045358091004535809.

Input Format

The first line contains three integers n,k,tn, k, t. If t=0t = 0, compute the prefix sum; if t=1t = 1, compute the difference.
The second line contains nn integers representing the sequence aa.

Output Format

Output one line with nn integers, representing the kk-th order difference or prefix sum of aa.

8 3 0
1 9 2 6 0 8 1 7
1 12 35 76 135 220 332 478 
8 3 1
1 9 2 6 0 8 1 7
1 6 1004535787 26 1004535788 24 1004535780 28

Hint

Constraints

1n1051 \le n \le 10^5
0ai1090 \le a_i \le 10^9
$1 \le k \le 10^{2333}, k \not \equiv 0 \pmod{1004535809}$

Translated by ChatGPT 5