| MEPhI Аutumn Cup 2026 |
|---|
| Finished |
A student is preparing for an olympiad and plans to solve $$$n$$$ problems. The difficulty of the $$$i$$$-th problem is $$$a_i$$$.
Before the preparation starts, the problems are randomly shuffled, and then the student solves them in the resulting order. Each of the $$$n!$$$ permutations of the problems is equally likely. Initially, the student remembers the solutions to none of the problems.
For each problem $$$i$$$, the number $$$x_i$$$ is also known — the probability of forgetting the solution to the problem, in percent. Then $$$p_i = x_i / 100$$$ is the probability of forgetting the solution to the $$$i$$$-th problem.
When solving the next problem $$$i$$$, the student performs the following actions:
— Solves problem $$$i$$$ and remembers its solution.
— Gains $$$1$$$ unit of experience for each problem $$$j$$$ whose solution he remembers and for which $$$a_j \le a_i$$$.
— For each problem $$$j \ne i$$$ whose solution he remembers, with probability $$$p_j$$$ he forgets its solution. All such events are independent.
Thus, the student cannot forget the solution to a problem immediately after solving it. However, after solving each subsequent problem, he may forget it with the corresponding probability for that problem. If the solution to a problem is forgotten, then the student will not remember it again until the end of the preparation.
Find the expected amount of experience gained.
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 3 \cdot 10^5)$$$ — the number of problems.
Each of the next $$$n$$$ lines contains two integers $$$a_i$$$ and $$$x_i$$$ $$$(1 \le a_i \le 10^9,\ 0 \le x_i \le 100)$$$ — the difficulty of the $$$i$$$-th problem and the number specifying the probability of forgetting its solution in percent.
The values $$$a_i$$$ are not necessarily distinct.
It can be shown that the expected amount of experience can be represented as an irreducible fraction $$$\frac{p}{q}$$$, where $$$q$$$ is not divisible by $$$998244353$$$.
In the only line, output one number — the value of $$$p \cdot q^{-1}$$$ modulo $$$998244353$$$, where $$$q^{-1}$$$ is the multiplicative inverse of $$$q$$$ modulo $$$998244353$$$.
33 506 1001 0
915057328
51 231 782 452 893 100
154133329
| Name |
|---|


