QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 2048 MB Total points: 100 Hackable ✓

#218. 2D Convex Hull

Statistics

Given $n$ points $P_i(x_i, y_i)$ in a 2D plane, calculate the perimeter of their convex hull.

Input

The first line contains an integer $n$.

The next $n$ lines each contain two integers $x_i, y_i$.

Output

Output a single real number representing the answer. The relative or absolute error must not exceed $10^{-6}$.

Examples

Input 1

5
1 2
1 4
2 3
3 5
4 2

Output 1

10.3983456376681690

Input 2

9
1 3
1 7
2 2
2 5
2 9
3 4
3 6
4 1
5 5

Output 2

19.0094551429903350

Subtasks

For $100\%$ of the data, $3 \leq n \leq 2 \times 10^5$, $-10^9 \leq x_i, y_i \leq 10^9$.

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.