Machining Disc Rotors
题号:NC234840
时间限制:C/C++/Rust/Pascal 8秒,其他语言16秒
空间限制:C/C++/Rust/Pascal 1024 M,其他语言2048 M
Special Judge, 64bit IO Format: %lld

题目描述

Edward is a worker for Aluminum Cyclic Machinery. His work is to control the mechanical arms to cut out some parts of the mould material. Here is a brief introduction to his work.

Suppose the operation panel for him is a Euclidean plane with the coordinate system. Originally the mould is a disc whose centre coordinates is (0,0) and of radius R. Edward controls nn different mechanical arms to cut out and erase those all of the mould within their affected areas. The affected area of the i-th mechanical arm is a circle whose centre coordinate is (x_i,y_i) and of radius r_i. In order to obtain the highly developed product, it is guaranteed that the affected areas of any two mechanical arms share no intersection and no one has an affected area containing the whole original mould.

Your task is to determine the diameter of the residual mould. Here the diameter of a subset, which may not be convex, over the Euclidean plane is the supremum (i. e. the least upper bound) of distances between every two points in the subset. Here is an illustration of the sample.

输入描述:

The input contains several test cases, and the first line contains a positive integer T indicating the number of test cases which is up to 5000.

For each test case, the first line contains two integers n and R, where  and .

The following n lines describe all mechanical arms controlled by Edward, the i-th of which contains three integers x_i,y_i and r_i describing the affected area of the i-th mechanical arm, where  and .

输出描述:

For each test case, output a line containing "Case #x: y" (without quotes), where x is the test case number starting from 1, and y is the diameter of the remaining area with an absolute or relative error of at most . Precisely speaking, assume that your answer is a and and the jury's answer is b, your answer will be considered correct if , where  means the maximum of x and y and  means the absolute value of x.
示例1

输入

复制
1
3 10
0 12 10
11 -6 10
-11 -6 10

输出

复制
Case #1: 18.611654895000252