QOJ.ac

QOJ

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

#784. Rotating Calipers

الإحصائيات

Given a convex polygon with $n$ vertices in counter-clockwise order (three points may be collinear), find its diameter.

Input

The first line of the input contains an integer $n$.

The next $n$ lines each contain two integers $x_i, y_i$, describing the coordinates of a point. The coordinates are given in counter-clockwise order.

Output

Output a single real number representing the answer. Your answer will be considered correct if the relative error compared to the standard answer does not exceed $10^{-6}$.

Examples

Input 1

3
0 0
4 0
2 2

Output 1

4

Input 2

4
0 0
1 0
1 1
0 1

Output 2

1.414213562373

Input 3

10
0 0
461074 -72768411
3213786 -131277098
9156758 -204048615
50058801 -267750564
98614697 -289078664
138651620 -243972492
191427505 -152569765
131060323 -88251044
85141546 -55035262

Output 3

305436298.50498565947291157209925

Subtasks

For all data, $3 \leq n \leq 5 \times 10^5$, $-10^9 \le x_i, y_i \le 10^9$.

  • Subtask 1 (10 pts): $n \leq 10^3$
  • Subtask 2 (30 pts): $n \leq 3 \times 10^4$
  • Subtask 3 (60 pts): No additional constraints.

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.