Goat Ropes
Time limit8sMemory limit128 MB
Assign nonnegative radii to n points so that every pair satisfies r_i + r_j <= distance, and maximize the sum of all radii.
- Level
Hard8 of 10
- Topics
- Graph, Minimum spanning tree, Greedy, Math
- Solved
- No attempts yet
Problem
A farmer has goats and, in the same field, fixed posts. He wants to tie each goat to a different post with a rope, giving every goat as much room to roam as possible. A goat tied to a post with a rope of length can graze anywhere inside the circle of radius centered at that post.
Goat ropes tangle easily, so no goat may ever be able to wander into another goat's grazing area: no two grazing circles may overlap, though they may just touch at a single point. Choosing the rope lengths under this rule, what is the maximum total length of rope the farmer can use?
Formally, assign a radius to each post so that for every pair of distinct posts , where is the distance between them. Maximize .
Input
The input contains several test cases. Each test case begins with an integer (), the number of posts. Each of the next lines contains two integers and (, ), the Cartesian coordinates in meters of a post. No two posts share the same position. The field is large enough that the goats never reach its border. The input ends with a line containing a single .
Output
For each test case, output on its own line the maximum total length of rope the farmer could use, in meters, rounded to exactly two decimal places. Do not print any extra spaces, and do not print a blank line between answers.