|
||||||||||
Building FenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 2776 Accepted Submission(s): 656 Special Judge Problem Description Long long ago, there is a famous farmer named John. He owns a big farm and many cows. There are two kinds of cows on his farm, one is Friesian, and another one is Ayrshire. Each cow has its own territory. In detail, the territory of Friesian is a circle, and of Ayrshire is a triangle. It is obvious that each cow doesn't want their territory violated by others, so the territories won't intersect. Since the winter is falling, FJ has to build a fence to protect all his cows from hungry wolves, making the territory of cows in the fence. Due to the financial crisis, FJ is currently lack of money, he wants the total length of the fence minimized. So he comes to you, the greatest programmer ever for help. Please note that the part of fence don't have to be a straight line, it can be a curve if necessary. Input The input contains several test cases, terminated by EOF. The number of test cases does not exceed 20. Each test case begins with two integers N and M(0 ¡Ü N, M ¡Ü 50, N £« M > 0)which denotes the number of the Friesian and Ayrshire respectively. Then follows N + M lines, each line representing the territory of the cow. Each of the first N lines contains three integers Xi, Yi, Ri(1 ¡Ü Ri ¡Ü 500),denotes the coordinates of the circle's centre and radius. Then each of the remaining M lines contains six integers X1i, Y1i, X2i, Y2i, X3i, Y3i, denotes the coordinates of the triangle vertices. The absolute value of the coordinates won't exceed 10000. Output For each test case, print a single line containing the minimal fence length. Your output should have an absolute error of at most 1e-3. Sample Input
Sample Output
Hint Please see the sample picture for more details, the fence is highlighted with red. Source | ||||||||||
|