#P6733. 「Wdsr-2」间歇泉
「Wdsr-2」间歇泉
Description
There is a geyser that produced cups of water. For some reasons, each cup has a different temperature and volume. The temperature of the -th cup is , and the volume is .
Now mix any two cups of water. Each time you mix two cups, you will get a new temperature value. Find the -th highest possible temperature value (ignoring heat loss).
It is recommended that your answer keep at least digits after the decimal point (it will be accepted if the difference from the standard answer is within ).
Input Format
The first line contains two integers , as described above.
The next lines each contain two numbers .
Output Format
Output one real number, representing the -th highest temperature after mixing.
5 1
1 5
4 2
5 3
2 3
1 4
4.500
Hint
Explanation for Sample 1
Mixing the -st and the -th cups gives a temperature value of . It can be seen that this is the highest possible water temperature.
Sample 2
See the attached files .
Constraints and Notes
This problem uses bundled testdata.
- : .
- : guaranteed .
- : no special restrictions.
- : hack testdata.
For of the data: , , .
The time limit is for Subtasks 2/3/4, and for Subtask 1.
Prerequisite Knowledge
For two cups of water with volume and temperature , the temperature after mixing is:
Note
The testdata of this problem is generated using SvRan, taking only .
Translated by ChatGPT 5
京公网安备 11011102002149号