#P16626. [GKS 2017 #D] Trash

    ID: 18982 远端评测题 5000ms 1024MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>数学计算几何2017Special JudgeGoogle Kick Start

[GKS 2017 #D] Trash

Problem Description

Bob is an outstanding Googler. He loves efficiency, so he does everything well and quickly. Today, Bob has discovered that the trash can near his desk has disappeared! Sadly, this means that he has to use another nearby trash can instead. Since getting out of his seat to use the trash can would lower his productivity, Bob has decided to throw his trash into that trash can!

But there are many obstacles in the Google office. For example, it is rude if the thrown trash hits somebody, or the wall, or anything else. Bob hopes to throw the trash without touching any existing obstacles.

To simplify this problem, we will only consider the vertical plane that includes Bob and the trash can. Bob is at point (0,0)(0, 0); the trash can is at point (P,0)(P, 0). Moreover, there are NN obstacles in the office; each of them is a single point, and the i-th one has coordinates (Xi,Yi)(X_i, Y_i). The ceiling of the office is a line with the expression y=Hy=H in the plane. Since Bob is in one of the new high-tech floating offices, we do not consider the office floor in this problem; you do not need to worry about collisions with it. Bob will throw a piece of trash that is a circle with radius RR. The center of the piece of trash starts off at (0,0)(0, 0). When the piece of trash is thrown, the center of the piece of trash must follow the path of a parabola with the expression f(x)=ax(xP)f(x)=ax(x-P), where 0xP0 \le x \le P, and aa can be any real number less than or equal to 00. The piece of trash is only considered thrown away when its center reaches the trash can's point, and it is not enough for some part of the piece of trash to just touch that point.

Bob is wondering: what is the largest piece of trash he can throw without hitting the ceiling or any obstacles? That is, we must find the maximum value of RR for which there is at least one value aa that satisfies the following: for any 0xP0 \le x \le P, the Euclidean distance between (x,f(x))(x, f(x)) and (x,H)(x, H) is greater than RR, and for each ii, the Euclidean distance between the point (x,f(x))(x, f(x)) and (Xi,Yi)(X_i, Y_i) is greater than or equal to RR.

Input Format

The input starts with one line containing one integer TT, the number of test cases. TT test cases follow. The first line of each test case contains three integers NN, PP, and HH: the number of obstacles, the x-coordinate of the trash can, and the height of the ceiling. Then, there are NN more lines; the i-th of those lines represents the i-th obstacle, and has two integers XiX_i and YiY_i, representing that obstacle's coordinates.

Output Format

For each test case, output one line Case #x: y, where xx is the test case number (starting from 11) and yy is a double representing the maximum radius RR. Your answer will be considered correct if it is within an absolute or relative error of 10410^{-4} of the correct answer.

4
1 10 10
5 3
1 10 10
5 4
1 100 10
50 3
2 10 10
4 2
6 7
Case #1: 3.23874149472
Case #2: 4.0
Case #3: 3.5
Case #4: 2.23145912401

Hint

Note that the last sample case would not appear in the Small dataset.

The following picture illustrates Sample Case #1. Bob is at (0,0)(0, 0), and the trash can is at (10,0)(10, 0). There is a obstacle at point (5,3)(5, 3), marked with a star. If Bob throws trash over the top of the obstacle, the maximal RR is 3.23873.2387, which requires an aa of about 0.2705-0.2705. If Bob throws trash under the obstacle, the maximal RR is 33, which requires an aa of 00. So the maximum RR for this case is about 3.23873.2387.

:::align{center} :::

Sample Case #2 is like Sample Case #1, but the obstacle is one unit higher. Now, if Bob throws the trash under the obstacle, the maximal RR is 44 (for a=0a = 0). If he throws the trash over the obstacle, he can only use trash with a radius up to about 2.83062.8306 (with a=0.4a = -0.4). So the maximum RR for this case is 44.

Limits

1T501 \le T \le 50.

2P10002 \le P \le 1000.

2H10002 \le H \le 1000.

0<Xi<P0 < X_i < P.

0<Yi<H0 < Y_i < H.

Small dataset (Test set 1 - Visible)

N=1N = 1.

Large dataset (Test set 2 - Hidden)

1N101 \le N \le 10.