#P12519. 「MSTOI-R1」热开水

「MSTOI-R1」热开水

Background

Xiao M has recently been playing a new game, where rksrks is a value used to measure a player's strength. rksrks is divided into single-song rksrks and total rksrks, and both keep two decimal places.

After playing a song, you will get a score accacc (accuracy), shown as a percentage.

Problem Description

Each song has a difficulty constant. A song is counted toward rksrks only when its acc70%acc\ge 70\%; otherwise, the song's rksrks is 00. The single-song rks=[(100×acc55)45]2×rks=[\frac{(100\times acc-55)}{45}]^2\times difficulty constant.

If you play the same song multiple times, its single-song rksrks keeps the maximum value among all attempts. Total rks=rks= the average of these 55 single-song rksrks values: the largest 44 single-song rksrks, and the largest single-song rksrks among songs with accacc equal to 100%100\% (if there is no song with accacc equal to 100%100\%, then this item is treated as 00).

For convenience of representation and calculation, both single-song rksrks and total rksrks should keep 22 decimal places (no rounding).

Xiao M has nn songs to play. For the ii-th song, the difficulty constant is cic_i. On day 11, Xiao M can reach ai%a_i\% accuracy, and on day kk, Xiao M can reach min(100%,ai%+(k1)×bi%)min(100\%,a_i\%+(k-1)\times b_i\%). Xiao M plays all these nn songs every day. Find the earliest day on which Xiao M's total rksrks can be m\ge m.

Input Format

The first line contains a positive integer nn and a decimal number mm.

The next nn lines each contain three decimal numbers aia_i, bib_i, cic_i.

The next line contains 55 decimal numbers did_i. The first 44 are Xiao M's largest 44 single-song rksrks, and the last one is the largest single-song rksrks among songs with accacc equal to 100%100\%. Note that the songs corresponding to these 55 single-song rksrks values are all different from the above nn songs, and you may treat them as Xiao M's results on day 00.

Output Format

Output one integer: the earliest day on which Xiao M's total rksrks can be m\ge m. 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 rksrks, after ÷45\div 45, you must keep 22 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 100%100\% of the testdata: 1n1051\le n\le10^5, 0m170\le m\le17, 0ai1000\le a_i\le100, 0.01bi1000.01\le b_i\le100, 1ci171\le c_i\le17, 0di170\le d_i\le17.

Test point Special property
131\sim3 n100n\le100
44 m=0m=0
55 di=0d_i=0
6106\sim10 n103n\le10^3
111511\sim15 n104n\le10^4
162016\sim20 None

Translated by ChatGPT 5