Stochastic DominanceAI (CI翻译)
Problem Statement
Let $L=10^8$.
You are given an integer $N$ and a non-negative integer sequence $A=(A_1,A_2,\cdots,A_M)$ of length $M$ ($0 \leq A_i < L$). For each $k=1,2,\cdots,N$, solve the following problem:
There are $k$ red balls numbered from $1$ to $k$ and $k$ blue balls numbered from $1$ to $k$. Now, you will write a real number on each ball in the following way. Here, all random choices are independent.
- For each
$1 \leq i \leq k$, the number written on red ball$i$is$L \times (i-1)+A_{j_i}$. Here,$j_i$is an integer chosen uniformly at random from the range between$1$and$M$(inclusive). - For each
$1 \leq i \leq k$, the number written on blue ball$i$is a real number chosen uniformly at random from the range$[0,k \times L)$.
Find the probability, modulo $998244353$, that the following condition is satisfied after writing numbers on all balls.
- For any real number
$x$($0 \leq x \leq k \times L$), "the number of red balls with a number written that is at most$x$"$\geq$"the number of blue balls with a number written that is at most$x$".
Definition of probability modulo $998244353$ It can be proved that the desired probability is always a rational number. Also, under the constraints of this problem, it can be proved that if the desired rational number is represented as an irreducible fraction $\frac{P}{Q}$, then $Q \neq 0 \pmod{998244353}$. Therefore, there uniquely exists an integer $R$ satisfying $R \times Q \equiv P \pmod{998244353}, 0 \leq R \lt 998244353$. Output this $R$.
Constraints
$1 \leq N \leq 250000$$1 \leq M \leq 250000$$0 \leq A_i < L=10^8$- All input values are integers.
Input
The input is given from Standard Input in the following format:
N M
A_1 A_2 \cdots A_M
Output
Output $N$ lines. The $i$-th line should contain the answer for $k=i$.
{"titleZh":"随机支配","bodyZh":"## 题目描述\n\n令 $L=10^8$。\n\n给定一个整数 $N$ 和一个长度为 $M$ 的非负整数序列 $A=(A_1,A_2,\\cdots,A_M)$($0 \\leq A_i < L$)。对于每个 $k=1,2,\\cdots,N$,请解决以下问题:\n\n有 $k$ 个编号为 $1$ 至 $k$ 的红球,以及 $k$ 个编号为 $1$ 至 $k$ 的蓝球。现在按照以下方式在每个球上写下一个实数。下述所有随机选择均相互独立。\n\n- 对于每个 $1 \\leq i \\leq k$,在红球 $i$ 上写下的数为 $L \\times (i-1)+A_{j_i}$。其中,$j_i$ 是从 $1$ 到 $M$(包含端点)的范围内均匀随机选择的整数。\n- 对于每个 $1 \\leq i \\leq k$,在蓝球 $i$ 上写下的数是从区间 $[0,k \\times L)$ 中均匀随机选择的实数。\n\n求在所有球上写下数字后,满足以下条件的概率(对 $998244353$ 取模)。\n\n- 对于任意实数 $x$($0 \\leq x \\leq k \\times L$),“写下的数不超过 $x$ 的红球数量”$\geq$“写下的数不超过 $x$ 的蓝球数量”。\n\n## 概率对 $998244353$ 取模的定义\n\n可以证明,所求概率始终为有理数。此外,在本题约束条件下可以证明:若将所求有理数表示为最简分数 $\frac{P}{Q}$,则 $Q \\neq 0 \\pmod{998244353}$。因此,存在唯一的整数 $R$ 满足 $R \\times Q \\equiv P \\pmod{998244353}$ 且 $0 \\leq R \\lt 998244353$。输出该 $R$。\n\n## 约束条件\n\n- $1 \\leq N \\leq 250000$\n- $1 \\leq M \\leq 250000$\n- $0 \\leq A_i < L=10^8$\n- 所有输入值均为整数。\n\n## 输入格式\n\n输入从标准输入给出,格式如下:\n\n\n\n## 输出格式\n\n输出 \nN M\nA_1 A_2 \\cdots A_M\n$N$ 行。第 $i$ 行应包含 $k=i$ 时的答案。"}AI (CI翻译)
样例
2 1
50000000
499122177
686292993
3 5
78682095 25048034 71067122 94666780 1927105
741897823
406774904
435399949
10 7
40490214 25131781 2271243 52064315 34467030 27419560 56103210
457696464
497746652
679391958
742383895
245278311
709723420
729551291
1911348
414224424
650563524
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。