Time

13:13:57
23 May 2012
Version for print

Convex hull

   On the plane, given N points in their Cartesian coordinates. Find the minimum perimeter polygon containing all these points. Guaranteed that the desired polygon has non-zero area.


Specifications

   Input

   The first line contains the number N, then - N rows with the pairs of coordinates.

   3N1000, -10000xi, yi10000, all numbers are integers, all points are distinct.

   Output

   Derive a single number - the length of the perimeter to one decimal place.


Problem information

Time Limit: 2 seconds
Memory Limit: 64 MB
Balls for the passed test: 5
Complexity: 11% 119/134

Example

Example input

5
1 0
0 1
-1 0
0 -1
0 0

Example output

5.7


← Route 2 Problems Birthday →