Convex hull
Hard
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
On a plane, you are given n points. Your task is to construct the convex hull of these points and calculate the length of its perimeter.
Input
The first line contains an integer n (1 ≤ n ≤ 20000), representing the number of points. Each of the next n lines provides two integers, x_i and y_i, which are the coordinates of a point. These coordinates are bounded by 10000 in absolute value.
Output
Output the perimeter length of the convex hull with the highest precision possible. If the convex hull consists of exactly 2 points, output twice the length of the line segment connecting them.
Examples
Input #1
Answer #1
Submissions 892
Acceptance rate 7%