Safe Zone
Time limit1sMemory limit128 MB
Given disjoint circles, find the shortest closed fence enclosing all of them, which equals the convex hull perimeter plus the circumference of one circle.
- Level
Medium6 of 10
- Topics
- Geometry, Divide and conquer
- Solved
- No attempts yet
Problem
Yeonjong wants to install a new surveillance system in his yard.
There are circular objects in the yard. Along the boundary of the surveillance system he wants to build a high-voltage fence. The safe zone enclosed by the fence must be connected as a single region, and every object must lie inside this safe zone. No two objects overlap or touch. Write a program that minimizes the total length of the fence under these conditions.
Input
The first line contains the number of test cases (). Each test case begins with a line containing the number of objects (). The next lines each contain three numbers , , and : the -th object is a circle centered at with radius (, , ).
Output
For each test case, print on its own line the minimum length of a fence that encloses all objects, rounded to exactly 10 digits after the decimal point.