QOJ.ac

QOJ

حد الوقت: 1.0 s حد الذاكرة: 512 MB مجموع النقاط: 100 قابلة للهجوم ✓

#9581. City Stacking

الإحصائيات

The core mechanism of the once-popular casual game "Skyscraper" requires players to time their drops so that new floors land precisely on top of the previous ones. As the number of floors increases, the increasingly wobbly skyscraper adds challenge and excitement to the game.

Ears-and-Antlers-Fox feels that rectangular floors are too monotonous, so he has designed a modified stacking game based on irregular floor shapes. First, he prepares $n$ distinct points on a 2D plane. Then, the game proceeds in $n$ rounds:

  • Initially, all points are in an inactive state.
  • At the beginning of round $i$, point $i$ $(x_i, y_i)$ becomes active.
  • After round $i$ begins, the player can choose to perform the following operation: take all points currently in the active state, and use them to form a new "floor" shape, which is the convex hull of these points (the smallest convex polygon containing these points; if there is only one or two active points, the "floor" degenerates into a point or a line segment connecting the two points). Once the shape of the new "floor" is determined, the player can rotate it by any angle, translate it by any real number $x$, and then drop it vertically along the negative $y$-axis until a point or vertex on the boundary of the "floor" coincides with the $x$-axis or a previously placed "floor". Once it lands, the "floor" is considered placed and is fixed in place (ignoring physical laws for the sake of the original game's balance).
  • At the end of the game, the score is the maximum $y$-coordinate of any point or vertex on the boundary of all placed "floors".

Now that the fox has told you the coordinates of the $n$ points, can you find the maximum possible score for this modified stacking game?

Input

The first line contains an integer $n$ ($1 \le n \le 5000$), representing the number of points and rounds.

The next $n$ lines each contain two integers $x_i$ and $y_i$ ($-10^9 \le x_i, y_i \le 10^9$), representing the coordinates of point $i$.

It is guaranteed that all $n$ points are distinct.

Output

Output a single real number, the maximum possible score of the modified stacking game.

Your answer is considered correct if the absolute or relative error between your answer $a$ and the standard answer $b$ satisfies $\frac{|a-b|}{\max(1, |b|)} \le 10^{-6}$.

Examples

Input 1

7
1 0
0 1
0 0
1 1
1 2
3 2
3 3

Output 1

5.656854249

Note

For the example, the optimal strategy is to generate a new "floor" after the 2nd round, then rotate the "floor" (which has degenerated into a line segment) until it is perpendicular to the $x$-axis and drops to coincide with the $x$-axis, as shown in Figure 1-1.

Figure 1-1

Then, generate a new "floor" after the 7th round, rotate it to an appropriate angle, and drop it until its vertex coincides with the "floor" that has degenerated into a line segment, as shown in Figure 1-2.

Figure 1-2

It is not difficult to find that the $y$-coordinate of the highest point is $\sqrt{2} + 3\sqrt{2} = 4\sqrt{2} \approx 5.656854249$. It can be proven that this is the maximum possible score of the game.

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.