/
実行時間制限: 2 sec / メモリ制限: 1024 MiB
配点 : 1100 点
問題文
1\leq K\leq N を満たす正整数 N, K が与えられます。
(1, 2, \dots , N) の順列 P = (P_{1}, P_{2}, \dots , P_{N}) に対して、f(P) を以下のように定義します。
- 以下の条件を満たす長さ N の整数列 A = (A_{1}, A_{2}, \dots, A_{N}) の転倒数としてあり得る最小の値
- 任意の整数 1\leq i\leq N に対して |A_{i}| = P_{i} が成り立つ
a = 1, 2, \dots, N について、以下の問いに答えてください。
(1, 2, \dots , N) の順列 P = (P_{1}, P_{2}, \dots , P_{N}) であって、P_{K} = a を満たすものは (N - 1)! 通りありますが、その全てに対する f(P) の総和を 998244353 で割ったあまりを求めてください。
制約
- 1\leq K\leq N\leq 2\times 10^{5}
- 入力は全て整数
入力
入力は以下の形式で標準入力から与えられる。
N K
出力
N 行出力せよ。i 行目には a = i のときの答えを出力せよ。
入力例 1
4 2
出力例 1
3 3 6 8
入力例 2
1 1
出力例 2
0
入力例 3
16 7
出力例 3
262718137 262718137 826158422 869037161 443336358 897729892 154945392 124681723 861272045 3176021 900143166 451899023 365015181 740245202 732524873 391198612
Score : 1100 points
Problem Statement
You are given positive integers N and K satisfying 1\leq K\leq N.
For a permutation P = (P_{1}, P_{2}, \dots , P_{N}) of (1, 2, \dots , N), define f(P) as follows:
- The minimum possible value of the number of inversions of a length-N integer sequence A = (A_{1}, A_{2}, \dots, A_{N}) satisfying the following condition:
- |A_{i}| = P_{i} for every integer 1\leq i\leq N.
For a = 1, 2, \dots, N, answer the following question:
There are (N - 1)! permutations P = (P_{1}, P_{2}, \dots , P_{N}) of (1, 2, \dots , N) satisfying P_{K} = a. Find the sum, modulo 998244353, of f(P) over all of them.
Constraints
- 1\leq K\leq N\leq 2\times 10^{5}
- All input values are integers.
Input
The input is given from Standard Input in the following format:
N K
Output
Output N lines. The i-th line should contain the answer for a = i.
Sample Input 1
4 2
Sample Output 1
3 3 6 8
Sample Input 2
1 1
Sample Output 2
0
Sample Input 3
16 7
Sample Output 3
262718137 262718137 826158422 869037161 443336358 897729892 154945392 124681723 861272045 3176021 900143166 451899023 365015181 740245202 732524873 391198612