Convex hull
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
n points are given on the plane with their Cartesian coordinates. Find the polygon with minimum perimeter that contains all these points. It is known that the desired polygon has non-zero area.
Input
The first line contains the number of points n (3 ≤ n ≤ 1000) on the plane. The next n lines give the coordinates x[i]
, y[i]
(-10000 ≤ x[i]
, y[i]
≤ 10000) of these points. All input numbers are integers, all points are distinct.
Output
Print the perimeter of the polygon with one digit after the decimal point.
Examples
Input #1
Answer #1
Submissions 2K
Acceptance rate 29%