P7435 Simple Permutation Counting

Description

Let $\text{inv}_{\pi}$ denote the number of inversions of a permutation $\pi$. If the length of $\pi$ is $n$, then $$\text{inv}_{\pi}=\sum\limits_{i=1}^{n}\sum\limits_{j=i+1}^{n}[\pi_i>\pi_j]$$ Given two positive integers $n,k$, and a permutation $\pi^\prime$, define the weight $\text{val}_{\pi}$ of a permutation $\pi$ of length $n$ as $$\text{val}_{\pi}=\prod\limits_{i=1}^{n}\prod_{j=i+1}^{n}\pi_i^{[\pi_{i}>\pi_j]}$$ For $0\leq m\leq k$, compute $$\sum\limits_{\pi}[\text{inv}_\pi=m]\text{val}_\pi$$ where $\pi$ is a permutation of length $n$.

Input Format

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

Output Format

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

Explanation/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=0$ the answer is $1$, when $m=1$ it is $5$, when $m=2$ it is $15$, and when $m=3$ it is $18$. ### Constraints | Subtask ID | Points | $n\leq $ | $k\leq $ | | :----------: | :----------: | :----------: | :----------: | | Subtask 1 | $1$ | $6$ | | | Subtask 2 | $12$ | $40$ | | | Subtask 3 | $1$ | $998244352$ | $1$ | | Subtask 4 | $16$ | $998244352$ | $10$ | | Subtask 5 | $24$ | $2\times 10^5$ | | | Subtask 6 | $46$ | $998244352$ | | For $100\%$ of the testdata, $2\leq n\leq 998244352$, $1\leq k\leq \min(2\times 10^5,\frac{n(n-1)}{2})。$ Translated by ChatGPT 5