| MEPhI Аutumn Cup 2025 |
|---|
| Finished |
Andrey and Sasha love to play table tennis and have already played many matches. Since games under the usual rules ended very quickly, they decided to play until one of them scores $$$n$$$ points and has a lead of $$$k$$$ points.
The game proceeds as follows. Initially, each player has $$$0$$$ points. Then the game rounds begin. Each round ends with one of the two players winning (there can be no draws). As soon as one of the players has at least $$$n$$$ points and is at least $$$k$$$ points ahead of the opponent, the game ends.
Andrey and Sasha have played many games against each other. However, information about some of them has been lost. Andrey remembers that a total of $$$g$$$ rounds were played, and he won between $$$l$$$ and $$$l+13$$$ rounds. If he won $$$x$$$ rounds, it can be assumed that the probability of Andrey winning each round is constant and equal to $$$x/g$$$. This probability also does not change during the subsequent games.
Andrey became curious about the probability that he can win $$$s$$$ rounds in a row regardless of the outcome of the game. Since he does not remember the exact value of $$$x$$$, he wants to calculate this probability for any of the permissible $$$x$$$.
The answer must be output modulo $$$998244353$$$.
The first line contains 3 integers $$$n, k$$$, and $$$s$$$, ($$$1 \le n \le 3000$$$), ($$$1 \le k \le 300$$$), ($$$1 \le s \le 3000$$$).
The second line contains 2 integers $$$g$$$ and $$$l$$$ ($$$100 \le g \le 10^8$$$), ($$$0 \le l \le g - 13$$$) – the number of rounds played and the minimum number of rounds won by Andrey.
In a single line, output 2 numbers $$$x$$$ and $$$p$$$ – the chosen number of rounds won ($$$l \le x \le l + 13$$$) and the sought probability for this $$$x$$$ modulo $$$998244353$$$.
3 1 2300 100
100 242372086
100 50 50 652 356
365 964566959
| Name |
|---|


