#P3291. [SCOI2016] 妖怪

[SCOI2016] 妖怪

Description

Teacher Qiu is a monster enthusiast. He has nn monsters, each with two attributes: attack atk\mathrm{atk} and defense dnf\mathrm{dnf}. Determined to become a master of monsters, he sets off from Zhenxin Town on an unknown journey to see different sceneries.

The environment (a,b)(a, b) is defined by two parameters aa and bb, where aa and bb are positive real numbers. In environment (a,b)(a, b), a monster may decrease its attack by k×ak \times a and increase its defense by k×bk \times b, or increase its attack by k×ak \times a and decrease its defense by k×bk \times b. Here kk can be any real number, but atk\mathrm{atk} and dnf\mathrm{dnf} must always remain non-negative.

In environment (a,b)(a, b), the monster’s strength strength\mathrm{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 a=3a=3, b=2b=2, then for a monster with attack 66 and defense 22, the maximum achievable attack is 99 and the maximum achievable defense is 66. Therefore, this monster’s strength in the environment a=3a=3, b=2b=2 is 1515.

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 nn monsters can achieve. In other words, there exists a pair of positive real numbers (a,b)(a, b) such that the strongest strength among the nn monsters in that environment is minimized; you need to output this minimum strength.

Input Format

The first line contains an integer nn, the number of monsters.

Each of the next nn lines contains two integers atki\mathrm{atk}_i and dnfi\mathrm{dnf}_i, denoting the attack and defense of the ii-th monster.

Output Format

Output the strongest monster’s strength value in the most unfavorable case, with 44 digits after the decimal point.

3
1 1
1 2
2 2
8.0000

Hint

Constraints: For 100%100\% of the testdata, 1n1061 \le n \le 10^6, 0<atk,dnf1080 \lt \mathrm{atk}, \mathrm{dnf} \le 10^8.

Statement fixed by Starrykiller.

Translated by ChatGPT 5