logo AlgoBeat OnlineJudge
登录 注册

#213595. [GCJ 2008 #2] Star Wars

内存限制:1024 MiB 时间限制:3000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Near the planet Mars, in a faraway galaxy eerily similar to our own, there is a fight to the death between the imperial forces and the rebels. The rebel army has ships which we will consider as points . Each ship has a receiver with power . The rebel army needs to be able to send messages from the central cruiser to all the ships, but they are tight on finances, so they cannot afford a strong transmitter.

If the cruiser is placed at , and one of the other ships is at and has a receiver of power , then the power of the cruiser's transmitter needs to be at least:

Your task is to find the position for the cruiser that minimizes the power required for its transmitter, and to output that power.

输入格式

The first line of input gives the number of cases, . test cases follow.

Each test case contains on the first line the integer , the number of ships in the test case.

lines follow, each line containing four integer numbers , , and , separated by single spaces. These are the coordinates of the -th ship, and the power of its receiver. There may be more than one ship at the same coordinates.

输出格式

For each input case, you should output:

Case #X: Y

where is the number of the test case and is the minimal power that is enough to reach all the fleet's ships. Answers with a relative or absolute error of at most will be considered correct.

样例

样例输入 1

3
4
0 0 0 1
1 2 0 1
3 4 0 1
2 1 0 1
1
1 1 1 1
3
1 0 0 1
2 1 1 4
3 2 3 2

样例输出 1

Case #1: 3.50000000
Case #2: 0.00000000
Case #3: 2.33333333

数据范围与提示

Sample Explanation

In the first test case, the four ships have coordinates and powers respectively. We can place a cruiser with the power at the coordinates which will be able to reach all the ships.

In the second case we can place the cruiser right on top of the ship, with transmitter power 0.

Sample Explanation

Small dataset (10 Pts, Test set 1 - Visible)

Large dataset (20 Pts, Test set 2 - Hidden)