#abc333f. F - Bomb Game 2

F - Bomb Game 2

Score : 550550 points

问题描述

NN 名人员站成一排,第 ii 个人站在从前往数的第 ii 个位置。

重复以下操作直到队伍中只剩一个人:

  • 12\frac{1}{2} 的概率移除队伍最前面的人,否则将其移动至队伍末尾。

对于每个人员 i=1,2,,Ni=1,2,\ldots,N,求在模 998244353998244353 下,人员 ii 成为最后剩下的人的概率。(每次选择移除或不移除都是随机且独立的。)

如何寻找模 998244353998244353 下的概率

本问题中所求的概率可以证明总是有理数。此外,此问题的约束条件保证了如果所求概率表示为不可约分数 yx\frac{y}{x},则 xx 不会被 998244353998244353 整除。

现在,存在一个唯一的整数 zz,满足 0z9982443520 \leq z \leq 998244352(包含两端点),使得 xzy(mod998244353)xz \equiv y \pmod{998244353}。请报告这个 zz 值。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

There are NN people standing in a line, with person ii standing at the ii-th position from the front.

Repeat the following operation until there is only one person left in the line:

  • Remove the person at the front of the line with a probability of 12\frac{1}{2}, otherwise move them to the end of the line.

For each person i=1,2,,Ni=1,2,\ldots,N, find the probability that person ii is the last person remaining in the line, modulo 998244353998244353. (All choices to remove or not are random and independent.)

How to find probabilities modulo 998244353998244353

The probabilities sought in this problem can be proven to always be a rational number. Furthermore, the constraints of this problem guarantee that if the sought probability is expressed as an irreducible fraction yx\frac{y}{x}, then xx is not divisible by 998244353998244353.

Now, there is a unique integer zz between 00 and 998244352998244352, inclusive, such that xzy(mod998244353)xz \equiv y \pmod{998244353}. Report this zz.

Constraints

  • 2N30002\leq N\leq 3000
  • All input values are integers.

Input

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

NN

Output

Print the answer for people i=1,2,,Ni=1,2,\ldots,N, separated by spaces.

Sample Input 1

2

Sample Output 1

332748118 665496236

Person 11 will be the last person remaining in the line with probability 13\frac{1}{3}.

Person 22 will be the last person remaining in the line with probability 23\frac{2}{3}.

Sample Input 2

5

Sample Output 2

235530465 792768557 258531487 238597268 471060930

update @ 2024/3/10 01:20:26