3 5 7 5
5
499122183
443664163
For instance, the answer for $K=2$ is found as follows.
The bag contains card $1$ and card $2$, with $A_1=5$ and $A_2=7$ written on them, respectively.
* If you draw card $1$ in the first draw and card $1$ again in the second draw, we have $x=y=5$, so $\max(x,y)=5$.
* If you draw card $1$ in the first draw and card $2$ in the second draw, we have $x=5$ and $y=7$, so $\max(x,y)=7$.
* If you draw card $2$ in the first draw and card $1$ in the second draw, we have $x=7$ and $y=5$, so $\max(x,y)=7$.
* If you draw card $2$ in the first draw and card $2$ again in the second draw, we have $x=y=7$, so $\max(x,y)=7$.
These events happen with the same probability, so the sought expected value is $\frac{5+7+7+7}{4}=\frac{13}{2}$. We have $499122183\times 2\equiv 13 \pmod{998244353}$, so $499122183$ should be printed.7 22 75 26 45 72 81 47
22 249561150 110916092 873463862 279508479 360477194 529680742
{
"problem": {
"name": "Double Chance",
"description": {
"content": "There are $N$ cards called card $1$, card $2$, $\\ldots$, card $N$. On card $i$ $(1\\leq i\\leq N)$, an integer $A_i$ is written. For $K=1, 2, \\ldots, N$, solve the following problem. > We have a bag th",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "abc276_f"
},
"statements": [
{
"statement_type": "Markdown",
"content": "There are $N$ cards called card $1$, card $2$, $\\ldots$, card $N$. On card $i$ $(1\\leq i\\leq N)$, an integer $A_i$ is written.\nFor $K=1, 2, \\ldots, N$, solve the following problem.\n\n> We have a bag th...",
"is_translate": false,
"language": "English"
}
]
}