AtCoder Grand Contest 050 (Good Bye rng_58 Day 1)
D
Shopping
AtCoder
⌀ 2674
原题
← CE →
翻译中…

Problem Statement

翻译中…

There are $N$ people numbered $1$ through $N$, and $K$ items numbered $1$ through $K$. They play a turn-based game. Person $1$ takes the first turn, Person $2$ takes the next turn, then Person $3$, $\ldots$, Person $N$, then Person $1$ again, $\ldots$, Person $N$, Person $1$ again, $\ldots$, and so on, until all items are taken.

翻译中…

In each turn, the following happens:

翻译中…
  • If the person already wins an item, nothing happens.
  • Otherwise, he chooses one of the items he hasn't chosen yet uniformly at random, and secretly tells it to Snuke, the judge of the game. If the item is already taken by someone else, nothing happens; otherwise he wins the item.
翻译中…

For each $i$, compute the probability that Person $i$ wins an item, modulo $998,244,353$ (as described in the Notes section).

翻译中…

Note

翻译中…
  • All random choices are made independently.
  • We can prove that the game always ends in finite number of steps.
  • We can also prove that, whenever a player is asked to choose an item, he has at least one item he hasn't chosen yet.
  • We can also prove that the probabilities are rational numbers. When you print a probability, first write it as a fraction $\frac{y}{x}$, where $x, y$ are integers and $x$ is not divisible by $P = 998,244,353$ (under the constraints of the problem, such representation is always possible). Then, you need to print the only integer $z$ between $0$ and $P - 1$, inclusive, that satisfies $xz \equiv y \pmod{P}$.
翻译中…

Constraints

翻译中…
  • $1 \leq K \leq N \leq 40$
  • All values in the input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N K

翻译中…

Output

翻译中…

Print $N$ lines. On the $i$-th line, print the probability that the $i$-th person wins an item, modulo $998,244,353$.

翻译中…

样例

Input #1
3 2
Output #1
1
249561089
748683265
- First, Person $1$ chooses an item (call it Item $p$), and wins it. - Then, with $1/2$ probability, Person $2$ chooses the other item in the next turn and wins it, and the game ends. - With $1/2$ probability, Person $2$ chooses $p$, he doesn't win it, and Person $3$ takes the next turn. - With $1/4$ probability, Person $3$ chooses the other item, wins it, and the game ends. - With $1/4$ probability, Person $3$ chooses $p$ again. Then, next turn is Person $1$'s and nothing happens because he has already won an item. Then, in the next turn, Person $2$ chooses the other item for sure because he has already chosen $p$ in his previous turn, so he wins an item this time, and the game ends. To summarize, Person $1, 2, 3$ will get an item with probability $1, \frac{3}{4}, \frac{1}{4}$, respectively.
Input #2
4 3
Output #2
1
314262112
767169272
915057324
The probabilities are $1, \frac{47}{54}, \frac{77}{108}, \frac{5}{12}$.
Input #3
40 10
Output #3
1
868517173
27621563
837064957
222682471
512462123
662169358
927654899
421237429
47896491
462367772
888812171
300869511
63754652
144548024
358216674
895724239
274552277
722622637
946769993
579325471
777654313
142897955
607284898
8038340
863909530
63295741
862961672
335905745
944425523
358698956
299986928
847582651
197657467
180361665
412489246
762713624
410322243
646538576
79047758
题目信息
题号
agc050_d
时间限制
4 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。