#P2742. 【模板】二维凸包 / [USACO5.1] 圈奶牛Fencing the Cows

【模板】二维凸包 / [USACO5.1] 圈奶牛Fencing the Cows

Description

Farmer John wants to build a fence to enclose his cows, but his budget is limited. The fence he builds must include all the locations where his cows like to graze. Given the coordinates of these locations, compute the length of the shortest fence that can enclose all these points.

Input Format

The first line contains an integer nn, the number of grazing sites.

From line 22 to line (n+1)(n + 1), each line contains two real numbers. The real numbers xi,yix_i, y_i on line (i+1)(i + 1) represent the xx and yy coordinates of the ii-th grazing site.

Output Format

Output one real number, rounded to two decimal places, representing the length of the fence.

4
4 8
4 12
5 9.3
7 8
12.00

Hint

Constraints:

For 100%100\% of the testdata, it is guaranteed that 1n1051 \leq n \leq 10^5, 106xi,yi106-10^6 \leq x_i, y_i \leq 10^6. There are at most 22 digits after the decimal point.

Translated by ChatGPT 5