#P13443. [GCJ 2009 #2] Watering Plants

    ID: 15317 远端评测题 6000~12000ms 1024MiB 尝试: 0 已通过: 0 难度: 5 上传者: 标签>数学计算几何2009二分Special JudgeGoogle Code Jam

[GCJ 2009 #2] Watering Plants

题目描述

In your greenhouse, you have a number of plants which you need to water.

Each of the plants takes up an area which is a circle. No two of the plants overlap or touch each other.

You are going to buy two sprinklers. Each of the sprinklers will spray everything within a circle of radius RR with water.

One of the sprinklers will run in the morning, and one will run at night. For you to be satisfied that a plant will get enough water, either the whole area of the plant must be watered in the morning, or the whole area of the plant must be watered at night. So each of the circles representing a plant must be completely in one or both of the two circles representing the area the sprinklers can water.

Given the location and radius of each of the plants, find the minimum radius RR so that it is possible to place the two sprinklers to water all the plants. The sprinklers will be installed on the ceiling, so a sprinkler's position can be inside the area of a plant.

输入格式

  • One line containing an integer CC, the number of test cases in the input file.

For each test case, there will be:

  • One line containing NN, where NN is the number of plants you have.
  • NN lines, one for each plant, containing three integers "XX YY RR", where (X,Y)(X, Y) are the coordinates of the center of the plant, and RR is the radius of the plant.

输出格式

For each test case:

  • One line containing the string "Case #xx: RR" where xx is the number of the test case, starting from 1, and RR is the minimum radius of the sprinklers.

Any answer with absolute or relative error of at most 10510^{-5} will be accepted.

2
3
20 10 2
20 20 2
40 10 3
3
20 10 3
30 10 3
40 10 3
Case #1: 7.000000
Case #2: 8.000000

提示

Sample Explanation

In the first case, a sprinkler of radius at least 7 centered at (20,15)(20,15) will water the first two plants. A sprinkler of radius at least 3 will water the plant at (40,10)(40,10).

In the second case, one of the two sprinklers will need a radius of at least 8. Note that the plant at (30,10)(30,10) must be covered entirely by one of the two sprinklers.

Limits

  • 1X10001 \leq X \leq 1000
  • 1Y10001 \leq Y \leq 1000
  • 1R1001 \leq R \leq 100

Small Input(5 Pts)

  • Time limit: 30 6 seconds.
  • 1C101 \leq C \leq 10
  • 1N31 \leq N \leq 3

Large Input(25 Pts)

  • Time limit: 60 12 seconds.
  • 1C301 \leq C \leq 30
  • 1N401 \leq N \leq 40