千秋乐AI (CI翻译)
Problem Statement
题目描述
AI (CI翻译)A tournament is being held with $2N$ players. From now on, each player will play exactly one match. In the remaining $N$ matches, the $i$-th $(1\le i\le N)$ match is played between the $(2i-1)$-th and $2i$-th players.
一场锦标赛共有 $2N$ 名选手。接下来每位选手恰好参加一场比赛。在剩余的 $N$ 场比赛中,第 $i$ 场($1\le i\le N$)由第 $(2i-1)$ 名和第 $2i$ 名选手进行。AI (CI翻译)
In each match, one of the two competing players wins and the other loses. Which player wins is determined independently for each match, and each player wins with probability $\dfrac12$.
每场比赛中,两名选手一胜一负。每场比赛的胜者独立决定,每名选手获胜的概率均为 $\dfrac12$。AI (CI翻译)
Before the last $N$ matches begin, the $i$-th $(1\le i\le2N)$ player has won $A _ i$ times. After all matches are over, the champion is chosen from among the players with the most wins, uniformly at random and independently of the previous match results.
在最后 $N$ 场比赛开始前,第 $i$ 名($1\le i\le2N$)选手已经获胜 $A _ i$ 次。所有比赛结束后,将从获胜次数最多的选手中等概率随机选出冠军,且选出的结果与之前的比赛结果独立。AI (CI翻译)
For each of the first, second, $\ldots$, $2N$-th players, find the probability, modulo $998244353$, of that player becoming the champion.
请依次求出第 1、2、$\ldots$、$2N$ 名选手成为冠军的概率,答案对 $998244353$ 取模。AI (CI翻译)
Definition of probability modulo $998244353$ It can be proved that the sought probability is always a rational number. Moreover, under the constraints of this problem, it can be proved that when the rational number is expressed as an irreducible fraction $\frac{P}{Q}$, we have $Q {{}\not\equiv{}} 0 \pmod{998244353}$. Therefore, there is a unique integer $R$ satisfying $R \times Q \equiv P \pmod{998244353}, 0 \leq R \lt 998244353$. Find this $R$.
概率对 $998244353$ 取模的定义:可以证明,所求概率总是有理数。此外,在本题的约束条件下,可以证明将该有理数表示为既约分数 $\frac{P}{Q}$ 时,满足 $Q {{}\not\equiv{}} 0 \pmod{998244353}$。因此,存在唯一整数 $R$ 满足 $R \times Q \equiv P \pmod{998244353}, 0 \leq R \lt 998244353$。请求出这个 $R$。AI (CI翻译)
Constraints
约束条件
AI (CI翻译)$1\le N\le2\times10 ^ 5$$0\le A _ i\lt2N\ (1\le i\le 2N)$- All input values are integers.
$1\le N\le2\times10 ^ 5$$0\le A _ i\lt2N\ (1\le i\le 2N)$- 输入的所有数值均为整数。
Input
输入格式
AI (CI翻译)The input is given from Standard Input in the following format:
输入从标准输入给出,格式如下:AI (CI翻译)
N
A _ 1 A _ 2
A _ 3 A _ 4
\vdots
A _ {2N-1} A _ {2N}
N
A _ 1 A _ 2
A _ 3 A _ 4
\vdots
A _ {2N-1} A _ {2N}AI (CI翻译)
Output
输出格式
AI (CI翻译)Output the probability of the first player becoming the champion, the probability of the second player becoming the champion, $\ldots$, the probability of the $2N$-th player becoming the champion, in this order, separated by spaces, on a single line.
在一行中按顺序输出第 1 名选手成为冠军的概率、第 2 名选手成为冠军的概率、$\ldots$、第 $2N$ 名选手成为冠军的概率,相邻答案之间用空格分隔。AI (CI翻译)
样例
4
1 2
3 4
2 3
1 4
0 0 259959467 883862188 0 967049217 0 883862188
6
0 0
0 0
0 0
0 0
0 0
0 0
582309206 582309206 582309206 582309206 582309206 582309206 582309206 582309206 582309206 582309206 582309206 582309206
10
18 17
16 18
18 16
16 16
17 17
16 16
17 16
17 18
16 16
17 18
357877533 151989635 0 357877533 357877533 0 0 0 575116994 575116994 0 0 597386855 0 151989635 357877533 0 0 151989635 357877533
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。