#P7440. 「KrOI2021」Feux Follets

    ID: 8340 远端评测题 1500ms 512MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>动态规划 DP数学递推矩阵运算O2优化矩阵加速置换组合数学排列组合生成函数线性代数矩阵乘法线性递推微积分导数快速傅里叶变换 FFT快速数论变换 NTT

「KrOI2021」Feux Follets

Background

Note: σ(5307)=7440\sigma(5307)=7440, and among all xx satisfying σ(x)=7440\sigma(x)=7440, this is the only number that is congruent to 77 modulo 1010.

Problem Description

Let cycπ\text{cyc}_\pi be the number of cycles in the permutation π\pi when π\pi (of length nn) is viewed as a permutation mapping. Given two integers n,kn, k and a polynomial of degree k1k-1, for each 1mn1 \le m \le n, compute:

πF(cycπ)\sum\limits_{\pi} F(\text{cyc}_{\pi})

where π\pi ranges over all permutations of length mm such that there is no position ii with πi=i\pi_i = i.

Input Format

The first line contains two integers, denoting nn and kk.

The second line contains kk integers, giving the coefficients of the polynomial from low degree to high degree.

Output Format

Output one line with nn integers, denoting the answers modulo 998244353998244353.

3 2
0 1
0 1 2
6 4
11 43 27 7
0 88 176 1311 7332 53070
6 4
9 72 22 7
0 110 220 1551 8580 60990

Hint

Constraints

For 100%100\% of the testdata, 1n,k1051 \le n, k \le 10^5.

Translated by ChatGPT 5