AtCoder Beginner Contest 409
G
Accumulation of Wealth
AtCoder
⌀ 2616
原题
翻译中…

Problem Statement

翻译中…

You are given an integer $N \geq 2$ and an integer $P$ between $0$ and $100$, inclusive. Let $p=P/100$.

翻译中…

There is a sequence $A$. Initially, the length of $A$ is $1$, and its only element is $1$.

翻译中…

The following operation is repeated $N-1$ times on sequence $A$:

翻译中…
  • Let $m$ be the smallest positive integer that does not appear in $A$. With probability $p$, perform operation $1$; with probability $1-p$, perform operation $2$:
  • Operation $1$: Append $m$ to the end of $A$.
    • Operation $2$: Let $c_1,c_2,\dots,c_{m-1}$ be the number of times $1,2,\dots,m-1$ appear in $A$, respectively. Choose an integer $k$ between $1$ and $m-1$, inclusive, with probability proportional to $c_k$. That is, choose $k$ with probability $c_k/\sum_{j=1}^{m-1} c_j$. Then, append $k$ to the end of $A$.
翻译中…

For each $k=1,2,\dots,N$, find the expected number of occurrences of $k$ in $A$ after $N-1$ operations, modulo $998244353$.

翻译中…

Definition of expected value modulo $998244353$ It can be proved that the expected value you seek is always a rational number. Also, under the constraints of this problem, it can be proved that when this value is expressed as an irreducible fraction $\frac{P}{Q}$, we have $Q {{}\not\equiv{}} 0 \pmod{998244353}$. Therefore, there is a unique integer $R$ such that $R \times Q \equiv P \pmod{998244353}$ and $0 \leq R \lt 998244353$. Output this $R$.

翻译中…

Constraints

翻译中…
  • $2 \leq N \leq 10^5$
  • $0 \leq P \leq 100$
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N P

翻译中…

Output

翻译中…

Output $N$ lines. The $k$-th $(1\leq k \leq N)$ line should contain the expected number of occurrences of $k$ in $A$ after the operations, modulo $998244353$.

翻译中…

样例

Input #1
3 50
Output #1
124780546
124780545
748683265
The operations proceed as follows: - Initially, $A=(1)$. - $1$st operation: It becomes $A=(1,2)$ with probability $1/2$, and $A=(1,1)$ with probability $1/2$. - $2$nd operation: - If $A=(1,2)$, it becomes $A=(1,2,3)$ with probability $1/2$, $A=(1,2,1)$ with probability $1/4$, and $A=(1,2,2)$ with probability $1/4$. - If $A=(1,1)$, it becomes $A=(1,1,2)$ with probability $1/2$, and $A=(1,1,1)$ with probability $1/2$. The expected numbers of occurrences of $1,2,3$ in the final $A$ are $\frac{15}{8}, \frac{7}{8}, \frac{1}{4}$, respectively.
Input #2
2 0
Output #2
2
0
Input #3
5 24
Output #3
297734288
442981554
937492320
798158491
518366411
题目信息
题号
abc409_g
时间限制
2 s
内存限制
1024 MB

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