luogu#P9621. 下次再见
下次再见
Background
In the season that has passed, the lost treasure.
Is a precious jigsaw puzzle missing one corner.
Just like how white snow gently piles up on the streets.
Let it also fill all the blank spaces in the memory album.
Problem Description
There is a piece of music made up of circles. The player will uniformly randomly choose a starting position from , then click that position and all circles after it in order to finish playing the piece.
For each circle, the click accuracy has four possible judgments: .
There is a mechanism: after consecutive judgments, the player will be forced to exit the game; otherwise, the player will keep playing until all circles have been clicked.
Now you are given, for each circle, the probability that the player gets each judgment. For the -th circle, the probabilities of , , , and are $P_{i,0}/100,\ P_{i,1}/100,\ P_{i,2}/100,\ P_{i,3}/100$, respectively. It is guaranteed that .
The score is a measure of the whole performance. It is computed as follows: suppose in the whole performance there are times , times , times , and times , then the score is .
You need to answer the expected value of the player's score.
Note: If the player is forced to exit the game, then when computing the score, the whole performance includes all clicks from the starting click up to and including the click that produced the last judgment.
For some test points with larger data sizes, in order to reduce the amount of input/output interaction, we use a different input method. You need to include the data generator provided in the attached file in your C++ code. It is recommended to browse the function names provided in the generator before reading the following content, as this can help you better understand the input format.
Input Format
The first line contains two integers .
When , after reading you need to call Ge.init(seed) to set the seed of the data generator. Otherwise, you may ignore .
The second line contains two integers .
Then there are two cases:
-
. The next lines each contain integers, representing .
-
. There is no further input. After your -th call to
Ge.get(a,b,c,d), the values of are , respectively.
Output Format
Output one integer per line, representing the answer .
Note: It can be proven that the answer can be expressed as . You need to output the result of multiplying by the modular inverse of modulo , and then taking it modulo .
0 0
4 2
10 20 20 50
20 10 20 50
20 20 10 50
20 50 10 20
530317523
0 280114129
5 5
36 23 30 11
0 52 25 23
14 61 23 2
10 41 37 12
0 12 78 10
898420164
1 114
5141 919
800181066
Hint
| Test Point ID | Constraints | Special Property |
|---|---|---|
: It is guaranteed that is the same for all positions.
: It is guaranteed that for all positions, equals or equals .
For test points , ; for test points , .
It is guaranteed that for all data, , , , .
Translated by ChatGPT 5