P2742 [Template] 2D Convex Hull / [USACO5.1] Fencing the Cows
Background
upd: Added a new set of hack testdata.
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 $n$, the number of grazing sites.
From line $2$ to line $(n + 1)$, each line contains two real numbers. The real numbers $x_i, y_i$ on line $(i + 1)$ represent the $x$ and $y$ coordinates of the $i$-th grazing site.
Output Format
Output one real number, rounded to two decimal places, representing the length of the fence.
Explanation/Hint
Constraints:
For $100\%$ of the testdata, it is guaranteed that $1 \leq n \leq 10^5$, $-10^6 \leq x_i, y_i \leq 10^6$. There are at most $2$ digits after the decimal point.
Translated by ChatGPT 5