#P12519. 「MSTOI-R1」热开水
「MSTOI-R1」热开水
Background
Xiao M has recently been playing a new game, where is a value used to measure a player's strength. is divided into single-song and total , and both keep two decimal places.
After playing a song, you will get a score (accuracy), shown as a percentage.
Problem Description
Each song has a difficulty constant. A song is counted toward only when its ; otherwise, the song's is . The single-song difficulty constant.
If you play the same song multiple times, its single-song keeps the maximum value among all attempts. Total the average of these single-song values: the largest single-song , and the largest single-song among songs with equal to (if there is no song with equal to , then this item is treated as ).
For convenience of representation and calculation, both single-song and total should keep decimal places (no rounding).
Xiao M has songs to play. For the -th song, the difficulty constant is . On day , Xiao M can reach accuracy, and on day , Xiao M can reach . Xiao M plays all these songs every day. Find the earliest day on which Xiao M's total can be .
Input Format
The first line contains a positive integer and a decimal number .
The next lines each contain three decimal numbers , , .
The next line contains decimal numbers . The first are Xiao M's largest single-song , and the last one is the largest single-song among songs with equal to . Note that the songs corresponding to these single-song values are all different from the above songs, and you may treat them as Xiao M's results on day .
Output Format
Output one integer: the earliest day on which Xiao M's total can be . If it cannot be achieved, output -1.
3 8.31
70.00 10.00 9.50
60.00 40.00 9.00
50.00 10.00 9.10
8.00 0.00 9.00 8.00 9.00
2
3 11.00
70.00 10.00 9.50
100.00 10.00 9.00
50.00 10.00 9.10
15.10 15.10 15.10 15.10 15.10
0
Hint
The testdata guarantees that all input decimals have exactly two decimal places. Note that all decimals during the computation must also keep two decimal places (no rounding) (for example, when computing single-song , after , you must keep decimal places before continuing), otherwise your result may differ from the answer.
It is recommended to use the following code to keep two decimal places:
double retain2(double x)
{
int y;
double z;
x*=100;
y=x;
z=y/100.0;
return z;
}
Constraints for of the testdata: , , , , , .
| Test point | Special property |
|---|---|
| None |
Translated by ChatGPT 5