QOJ.ac

QOJ

時間限制: 3 s 記憶體限制: 1024 MB 總分: 30

#5803. 浇灌植物

统计

在你的温室里有一些需要浇水的植物。

每株植物占据的区域都是一个圆。任意两株植物的区域都不会重叠或接触。

你打算购买两个喷水器。每个喷水器都能喷洒半径为 $R$ 的圆内的一切区域。

其中一个喷水器在早晨运行,另一个在晚上运行。为了让你确信一株植物能得到足够的水,该植物的整个区域必须要么在早晨被浇灌,要么在晚上被浇灌。因此,代表每株植物的每个圆必须完全位于代表喷水器可浇灌区域的两个圆中的一个或两个之内。

给定每株植物的位置和半径,求出最小的半径 $R$,使得可以放置两个喷水器来浇灌所有植物。喷水器将安装在天花板上,因此喷水器的位置可以位于植物区域的内部。

输入格式

输入文件包含一个整数 $C$,表示测试用例的数量。

对于每个测试用例:

  • 一行包含 $N$,表示植物的数量。
  • $N$ 行,每行包含三个整数 $X$、$Y$、$R$,其中 $(X, Y)$ 是植物中心的坐标,$R$ 是植物的半径。

输出格式

对于每个测试用例:

  • 输出一行 "Case #x: R",其中 $x$ 是测试用例的编号(从 1 开始),$R$ 是喷水器的最小半径。

任何绝对误差或相对误差不超过 $10^{-5}$ 的答案都将被接受。

数据范围

所有输入文件中的数字均为整数。

$1 \le X \le 1000$ $1 \le Y \le 1000$ $1 \le R \le 100$

小数据范围 (5 分)

$1 \le C \le 10$ $1 \le N \le 3$

大数据范围 (25 分)

$1 \le C \le 30$ $1 \le N \le 40$

样例

样例输入 1

2
3
20 10 2
20 20 2
40 10 3
3
20 10 3
30 10 3
40 10 3

样例输出 1

Case #1: 7.000000
Case #2: 8.000000

说明

在第一个案例中,一个半径至少为 7 且中心位于 $(20, 15)$ 的喷水器可以浇灌前两株植物。一个半径至少为 3 的喷水器可以浇灌位于 $(40, 10)$ 的植物。

在第二个案例中,两个喷水器中的一个需要至少 8 的半径。注意,位于 $(30, 10)$ 的植物必须完全被两个喷水器中的一个覆盖。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.