407533: GYM102823 B Array Modify

Memory Limit:256 MB Time Limit:3 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Array Modifytime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Given an array $$$A$$$ with $$$n$$$ numbers and two integers $$$L$$$, $$$m$$$. You have to output the final array after performing the following operation $$$m$$$ times:

$$$$$$A[i]=\left(\sum_{j=i}^{\min(i+L-1,n)}A[j]\right) \bmod P\text{, in order of } i=1, 2,\cdots, n$$$$$$

$$$P=998,244,353$$$ is a fixed number.

Input

The first line of input file contains an integer $$$T$$$ ($$$1\le T\le 20$$$), describing the number of test cases.

Then there are $$$2 \times T$$$ lines, with every two lines representing a test case.

The first line of each test case contains three integers: $$$n$$$, $$$L$$$, $$$m$$$ ($$$1\le n\le 100,000$$$, $$$1\le L\le n$$$, $$$1\le m\le 10^9$$$) described above.

The second line of that contains exactly $$$n$$$ integers,the $$$i$$$-th of which represents $$$A[i]$$$ ($$$0\le A[i]<P, \text{for }i=1, 2, \cdots, n$$$).

It is guaranteed that the sum of $$$n$$$ in all cases does not exceed $$$200,000$$$.

Output

You should output exactly $$$T$$$ lines.

For each case, print Case $$$d$$$: ($$$d$$$ represents the order of test case) first, and then output exactly $$$n$$$ integers, $$$i^{th}$$$ of which represents $$$A[i]$$$, separated by exactly one space.

ExampleInput
2
3 2 2
1 2 3
4 1 3
1 2 3 4
Output
Case 1: 8 8 3
Case 2: 1 2 3 4
Note

Sample 1:

加入题单

上一题 下一题 算法标签: