#P5641. 【CSGRound2】开拓者的卓识

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

【CSGRound2】开拓者的卓识

Background

(The picture above is reposted from a certain expert’s problem statement.)

Little K is daydreaming again. In his fantasy, he found a very interesting sequence aa and a very interesting number kk.

Problem Description

For a sequence interval [l,r][l,r], we define its kk-th order subsegment sum as sumk,l,rsum_{k,l,r}, where

$$sum_{k,l,r}=\begin{cases}\sum\limits_{i=l}^{r}a_i&,k=1\\\sum\limits_{i=l}^{r}\sum\limits_{j=i}^{r}sum_{k-1,i,j}&,k\geq 2\end{cases}$$

He is now standing at position 11. Each time he expands one cell to the right, he can increase his rp on the IOI contest field, so he wants to expand as many cells as possible. However, every time he expands from rr to r+1r+1, he needs to correctly answer sumk,1,rsum_{k,1,r}. Little K cannot be bothered to calculate it, so he leaves the task to you.

Input Format

Two lines. The first line contains n,kn,k, representing the length of aa and kk.

The second line contains nn positive integers, representing aa.

Output Format

One line. The ii-th number is sumk,1,isum_{k,1,i}. Since the answer is too large, you only need to output the value modulo 998244353998244353.

3 1
1 2 3
1 3 6
3 2
1 2 3
1 6 20
3 10
1 2 3
1 30 420

Hint

Sample Explanation 2

sum2,1,1=sum1,1,1=1sum_{2,1,1}=sum_{1,1,1}=1

$sum_{2,1,2}=sum_{1,1,1}+sum_{1,1,2}+sum_{1,2,2}=1+3+2=6$

$sum_{2,1,3}=sum_{1,1,1}+sum_{1,1,2}+sum_{1,1,3}+sum_{1,2,2}+sum_{1,2,3}+sum_{1,3,3}=1+3+6+2+5+3=20$

Constraints

Test Point ID Range of nn Range of kk Range of aia_i
121\sim 2 10\le 10
383\sim 8 103\le 10^3 105\le 10^5
99 105\le 10^5 =1=1 998244353\le 998244353
1010 =2=2
1111 =3=3
1212 10\le 10
131713\sim 17 102\le 10^2
1818 105\le 10^5
192519\sim 25 998244353\le 998244353

Translated by ChatGPT 5