TopCoder

User's AC Ratio

50.0% (1/2)

Submission's AC Ratio

33.3% (1/3)

Tags

Description

You are given a formal power series $f(x) = \sum_ {i=0}^ {N-1} a_ i x^ i \in \mathbb{F}_ {998244353}[[x]]$ and a non-negative integer $M$.
Calculate the first $N$ terms of $(f(x))^ M = \sum_ {i=0}^ {\infty} b_ i x^ i$.

Input Format

$N$ $M$
$a_ 0$ $a_ 1$ $\cdots$ $a_ {N-1}$

Output Format

$b_ 0$ $b_ 1$ $\cdots$ $b_ {N - 1}$

Sample Input 1

4 3
0 0 9 12

Sample Output 1

0 0 0 0

Sample Input 2

2 2
1 1

Sample Output 2

1 2

Sample Input 3

2 0
0 0

Sample Output 3

1 0

Hints

  • $1 \leq N \leq 5 \times 10^ {5}$
  • $0 \leq M \leq 10^ {18}$
  • $0 \leq a_ i < 998244353$

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 10000 2097152 2097152
1 10000 2097152 2097152
2 10000 2097152 2097152
3 10000 2097152 2097152
4 10000 2097152 2097152
5 10000 2097152 2097152
6 10000 2097152 2097152
7 10000 2097152 2097152
8 10000 2097152 2097152
9 10000 2097152 2097152
10 10000 2097152 2097152
11 10000 2097152 2097152
12 10000 2097152 2097152
13 10000 2097152 2097152
14 10000 2097152 2097152
15 10000 2097152 2097152
16 10000 2097152 2097152
17 10000 2097152 2097152
18 10000 2097152 2097152
19 10000 2097152 2097152
20 10000 2097152 2097152
21 10000 2097152 2097152
22 10000 2097152 2097152
23 10000 2097152 2097152
24 10000 2097152 2097152
25 10000 2097152 2097152
26 10000 2097152 2097152
27 10000 2097152 2097152
28 10000 2097152 2097152
29 10000 2097152 2097152
30 10000 2097152 2097152
31 10000 2097152 2097152
32 10000 2097152 2097152
33 10000 2097152 2097152
34 10000 2097152 2097152
35 10000 2097152 2097152
36 10000 2097152 2097152