#P3291. [SCOI2016] 妖怪
[SCOI2016] 妖怪
Description
Teacher Qiu is a monster enthusiast. He has monsters, each with two attributes: attack and defense . Determined to become a master of monsters, he sets off from Zhenxin Town on an unknown journey to see different sceneries.
The environment is defined by two parameters and , where and are positive real numbers. In environment , a monster may decrease its attack by and increase its defense by , or increase its attack by and decrease its defense by . Here can be any real number, but and must always remain non-negative.
In environment , the monster’s strength is defined as the sum of the maximum attack it can achieve and the maximum defense it can achieve in that environment, i.e., $\mathrm{strength}(a,b)=\max(\mathrm{atk}(a,b))+\max(\mathrm{dnf}(a,b))$.
For example, if the current environment has , , then for a monster with attack and defense , the maximum achievable attack is and the maximum achievable defense is . Therefore, this monster’s strength in the environment , is .
Thus, the strongest monster may change in different environments.
As an excellent monster trainer, Teacher Qiu wants to discover each monster’s maximum potential. He wants to know, in the most unfavorable case, the strongest strength value that his monsters can achieve. In other words, there exists a pair of positive real numbers such that the strongest strength among the monsters in that environment is minimized; you need to output this minimum strength.
Input Format
The first line contains an integer , the number of monsters.
Each of the next lines contains two integers and , denoting the attack and defense of the -th monster.
Output Format
Output the strongest monster’s strength value in the most unfavorable case, with digits after the decimal point.
3
1 1
1 2
2 2
8.0000
Hint
Constraints: For of the testdata, , .
Statement fixed by Starrykiller.
Translated by ChatGPT 5
京公网安备 11011102002149号