#P3789. Azuki loves coloring

    ID: 2730 远端评测题 1000~5000ms 500MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>数学递推洛谷原创O2优化线性递推,递推式级数快速傅里叶变换 FFT洛谷月赛

Azuki loves coloring

Description

After the release of NEKOPARA Vol.3, Azuki, who is not the protagonist in the new work, can finally take a break. To pass the time, she starts coloring a sequence of nn cells, each cell being one of three colors: black, white, or gray. For aesthetics, Azuki wants no two black cells to be adjacent and no two white cells to be adjacent. There are many such sequences. Azuki defines the weight of a sequence as the number of occurrences where a black cell and a white cell are adjacent. For example, the weight of the sequence "gray black white black" is 22. Azuki wants to know, for each ii with 0ik0 \le i \le k, how many sequences of length nn have weight ii. Since the answers can be large, she only needs the values mod 998244353\text{mod }998244353. Azuki promises that if you solve this problem, she will make you delicious cake.

Input Format

One line with two positive integers n,kn, k.

Output Format

One line with k+1k+1 positive integers, representing the values mod 998244353\text{mod }998244353 of the numbers of sequences whose weights are 0,1,,k0, 1, \dots, k.

3 3
11 4 2 0
20 10
1398101 4582670 8103780 10126770 9931780 8075094 5618340 3422330 1841460 893790 383524

Hint

For 30%30\% of the testdata, n,k100n, k \le 100.

For 50%50\% of the testdata, n,k5000n, k \le 5000, time limit 1 s1\ \text{s}. The remaining testdata have time limit 5 s5\ \text{s}.

For 70%70\% of the testdata, n,k60000n, k \le 60000.

For 100%100\% of the testdata, n1018,k100000n \le 10^{18}, k \le 100000.

Translated by ChatGPT 5