QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 64 MB Total points: 100

#2794. Yokai

Statistics

Teacher Qiu is a monster enthusiast who owns $n$ monsters, each with two attributes: attack power $atk$ and defense power $dnf$.

Teacher Qiu aspires to become a monster master, so he sets off from Pallet Town on an unknown journey to see different landscapes.

The environment has a significant impact on a monster's combat power. In a given environment, a monster can decrease its attack power by $k \times a$ and increase its defense power by $k \times b$, or increase its attack power by $k \times a$ and decrease its defense power by $k \times b$, where $a, b$ are positive real numbers and $k$ is any real number, provided that $atk$ and $dnf$ must always remain non-negative.

The combat power of a monster in an environment $(a, b)$ is the sum of the maximum attack power and maximum defense power the monster can achieve in that environment.

$$strength(a, b) = \max(atk(a, b)) + \max(dnf(a, b))$$

The environment is defined by two parameters $a$ and $b$, whose meanings are described above.

For example, in an environment where $a=3$ and $b=2$, a monster with $atk=6$ and $dnf=2$ can achieve a maximum attack power of $9$ and a maximum defense power of $6$. Therefore, the combat power of this monster in the environment $a=3, b=2$ is $15$.

Consequently, the strongest monster may change depending on the environment. As an excellent monster trainer, Teacher Qiu wants to discover the maximum potential of each monster. He wants to know the strongest combat power his $n$ monsters can achieve in the most unfavorable situation, which means finding a set of positive real numbers $(a, b)$ such that the maximum combat power among the $n$ monsters in that environment is minimized.

Input

The first line contains an integer $n$, representing the number of monsters.

The next $n$ lines each contain two integers $atk$ and $dnf$, representing the attack power and defense power of a monster.

Output

Output the strongest combat power of the monsters in the most unfavorable situation, rounded to 4 decimal places.

Examples

Input 1

3
1 1
1 2
2 2

Output 1

8.0000

Note

In the environment $a=1, b=1$, the maximum combat power among the 3 monsters is minimized, with a value of $8$.

Please use scanf("%d", &a) for input; using %lf or %lld may cause a timeout.

Note: Please round to 4 decimal places. This problem does not use a special judge (spj).

Constraints

  • $10\%$ of the data: $1 \le n \le 1000$.
  • $50\%$ of the data: $1 \le n \le 500000$.
  • $100\%$ of the data: $1 \le n \le 10^6$, $0 < atk, dnf \le 10^8$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.