#P2570. [ZJOI2010] 贪吃的老鼠
[ZJOI2010] 贪吃的老鼠
Description
Recently, mice have appeared in the cheese shop. Their goal is to eat all the cheese produced. The shop produces pieces of cheese per day. The -th piece has size , is produced at second , and must be eaten before second . Mouse eats at speed , so if it eats the -th piece alone, it takes time . The mice have special eating rules:
- At any moment, a mouse can eat at most one piece of cheese.
- At any moment, a piece of cheese can be eaten by at most one mouse.
Because the shelf life of cheese is often short, to eat all pieces, the mice can use a magical spell to extend the shelf life. Extending the shelf life by seconds means every becomes . Since the spell is costly, the mice want the minimum such that all cheese can be eaten.
Input Format
The first line contains an integer , the number of test cases.
For each test case, the first line contains two integers and , the numbers of cheese pieces and mice, respectively. The next lines each contain three integers . The final lines each contain one integer . The meanings of are as described above.
Output Format
Output lines. Each line contains a real number, the minimum you found. The absolute error between your answer and the standard answer must not exceed .
2
2 2
13 0 4
10 1 3
4
2
1 1
1 0 2
1
0.5
0
Hint
Sample Explanation:
For the first test case:
From second to second : The first mouse eats the first piece of cheese.
From second to second :
- The first mouse eats the second piece of cheese.
- The second mouse eats the first piece of cheese.
From second to second : the first mouse eats the first piece of cheese.
Constraints:
- For of the testdata, .
- For of the testdata, , , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号