#P7435. 简单的排列计数

    ID: 8251 远端评测题 1200ms 256MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>动态规划 DP数学O2优化动态规划优化组合数学排列组合Stirling 数生成函数快速傅里叶变换 FFT快速数论变换 NTT

简单的排列计数

Problem Description

Let invπ\text{inv}_{\pi} denote the number of inversions of a permutation π\pi. If the length of π\pi is nn, then

$$\text{inv}_{\pi}=\sum\limits_{i=1}^{n}\sum\limits_{j=i+1}^{n}[\pi_i>\pi_j]$$

Given two positive integers n,kn,k, and a permutation π\pi^\prime, define the weight valπ\text{val}_{\pi} of a permutation π\pi of length nn as

$$\text{val}_{\pi}=\prod\limits_{i=1}^{n}\prod_{j=i+1}^{n}\pi_i^{[\pi_{i}>\pi_j]}$$

For 0mk0\leq m\leq k, compute

π[invπ=m]valπ\sum\limits_{\pi}[\text{inv}_\pi=m]\text{val}_\pi

where π\pi is a permutation of length nn.

Input Format

The first line contains two integers n,kn,k.

Output Format

Output one line with k+1k+1 integers, representing the answers modulo 998244353998244353.

3 3
1 5 15 18

Hint

Sample Explanation 1

$$\text{inv}_{(1,2,3)}=0,\text{inv}_{(1,3,2)}=1,\text{inv}_{(2,1,3)}=1,\text{inv}_{(2,3,1)}=2,\text{inv}_{(3,1,2)}=2,\text{inv}_{(3,2,1)}=3$$$$\text{val}_{(1,2,3)}=1,\text{val}_{(1,3,2)}=3,\text{val}_{(2,1,3)}=2,\text{val}_{(2,3,1)}=6,\text{val}_{(3,1,2)}=9,\text{val}_{(3,2,1)}=18$$

So when m=0m=0 the answer is 11, when m=1m=1 it is 55, when m=2m=2 it is 1515, and when m=3m=3 it is 1818.

Constraints

Subtask ID Points nn\leq kk\leq
Subtask 1 11 66
Subtask 2 1212 4040
Subtask 3 11 998244352998244352 11
Subtask 4 1616 1010
Subtask 5 2424 2×1052\times 10^5
Subtask 6 4646 998244352998244352

For 100%100\% of the testdata, 2n9982443522\leq n\leq 998244352, 1kmin(2×105,n(n1)2)1\leq k\leq \min(2\times 10^5,\frac{n(n-1)}{2})。

Translated by ChatGPT 5