QOJ.ac

QOJ

Time Limit: 12 s Memory Limit: 1024 MB Total points: 100

#1930. こいしの無意識の順列

Statistics

「さとり」の心を読む目を閉じたとき、こいしは無意識に生きる能力を得た。彼女自身でさえ、自分が何をしているのかを知らない。 — 地霊殿

こいしは $1, 2, \ldots, n$ の $n$ 個の数を無意識に並べ替えている。

彼女は、順列 $p$ が $s=\sum\limits_{i=1}^{n-1} [p_i+1=p_{i+1}]$ を満たすとき、その順列を美しいと考える。ここで $[x]$ は、$x$ が真であれば $1$、偽であれば $0$ となる値である。

各 $k\in[0,n-1]$ について、長さ $n$ の美しい順列のうち、$k=\sum\limits_{i=1}^{n-1}[p_i< p_{i+1}]$ を満たすものの個数を求めたい。

入力

$n$ ($1 \leq n \leq 250\,000$) と $s$ ($0 \leq s < n$) が1行に与えられる。

出力

$n$ 個の整数を1行に出力せよ。$i$ 番目の整数は $k=i-1$ のときの答えを $998244353$ で割った余りである。

入出力例

入力 1

2 0

出力 1

1 0

入力 2

4 1

出力 2

0 3 6 0

入力 3

8 3

出力 3

0 0 0 35 770 980 70 0

注記

$f(p)=\sum\limits_{i=1}^{n-1}[p_i < p_{i+1}]$ とする。

テストケース 1:

$[2,1]$ が唯一の美しい順列である。また、$f([2,1])=0$ である。

テストケース 2:

美しい順列は以下の通りである。

$[1,2,4,3]$, $[1,3,4,2]$, $[1,4,2,3]$, $[2,1,3,4]$, $[2,3,1,4]$, $[3,1,2,4]$, $[3,4,2,1]$, $[4,2,3,1]$, $[4,3,1,2]$。最初の6つは $f(p)=2$ を満たし、残りは $f(p)=1$ を満たす。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.