CF645G.Armistice Area Apportionment
NOI/NOI+/CTSC
通过率:0%
时间限制:3.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
After a drawn-out mooclear arms race, Farmer John and the Mischievous Mess Makers have finally agreed to establish peace. They plan to divide the territory of Bovinia with a line passing through at least two of the n outposts scattered throughout the land. These outposts, remnants of the conflict, are located at the points (_x_1, _y_1), (_x_2, _y_2), ..., (x__n, y__n).
In order to find the optimal dividing line, Farmer John and Elsie have plotted a map of Bovinia on the coordinate plane. Farmer John's farm and the Mischievous Mess Makers' base are located at the points P = (a, 0) and Q = ( - a, 0), respectively. Because they seek a lasting peace, Farmer John and Elsie would like to minimize the maximum difference between the distances from any point on the line to P and Q.
Formally, define the difference of a line
relative to two points P and Q as the smallest real number d so that for all points X on line
, |PX - QX| ≤ d. (It is guaranteed that d exists and is unique.) They wish to find the line
passing through two distinct outposts (x__i, y__i) and (x__j, y__j) such that the difference of
relative to P and Q is minimized.
在一场旷日持久的“核武”竞赛之后,农夫约翰与捣蛋鬼制造者们终于同意缔结和平。他们计划用一条至少经过 n 个哨所中两个哨所的直线来划分波维尼亚(Bovinia)的领土。这些哨所是冲突遗留下来的遗迹,其坐标分别为 (_x_₁, _y_₁), (_x_₂, _y_₂), ..., (x__n, y__n)。
为了找到最优的分界线,农夫约翰与埃尔西已在坐标平面上绘制了波维尼亚的地图。农夫约翰的农场与捣蛋鬼制造者们的基地分别位于点 P = (a, 0) 和 Q = ( - a, 0)。由于他们渴望长久的和平,农夫约翰与埃尔西希望最小化该直线上任意一点到 P 与 Q 的距离之差的最大值。
形式化地,定义一条直线
关于两点 P 和 Q 的差值为最小的实数 d,使得对直线
上任意一点 X,均有 |PX - QX| ≤ d。(可以保证这样的 d 存在且唯一。)他们希望找到一条经过两个不同哨所 (x__i, y__i) 和 (x__j, y__j) 的直线
,使得该直线
关于 P 和 Q 的差值最小。
输入格式
The first line of the input contains two integers n and a (2 ≤ n ≤ 100 000, 1 ≤ a ≤ 10 000) — the number of outposts and the coordinates of the farm and the base, respectively.
The following n lines describe the locations of the outposts as pairs of integers (x__i, y__i) (|x__i|, |y__i| ≤ 10 000). These points are distinct from each other as well as from P and Q.
输入的第一行包含两个整数 n 和 a(2≤n≤100000,1≤a≤10000),分别表示前哨站的数量、农场与基地的坐标。
接下来的 n 行每行描述一个前哨站的位置,以一对整数 (xi,yi) 给出(∣xi∣,∣yi∣≤10000)。这些点互不相同,且均不同于点 P 和 Q。
输出格式
Print a single real number—the difference of the optimal dividing line. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6.
Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if
.
输出一个实数——最优分割线的差值。若你的答案的绝对误差或相对误差不超过 10−6,则视为正确。
即:假设你的答案为 a,评测组的答案为 b。当满足
时,评测程序将判定你的答案正确。
输入输出样例
输入#1
2 5 1 0 2 1
输出#1
7.2111025509
输入#2
3 6 0 1 2 5 0 -3
输出#2
0.0000000000
说明/提示
In the first sample case, the only possible line
is y = x - 1. It can be shown that the point X which maximizes |PX - QX| is (13, 12), with
, which is
.
In the second sample case, if we pick the points (0, 1) and (0, - 3), we get
as x = 0. Because PX = QX on this line, the minimum possible difference is 0.
在第一个样例中,唯一可能的直线
是 y=x−1。可以证明,使 ∣PX−QX∣ 最大的点 X 为 (13,12),此时
,即
。
在第二个样例中,若选取点 (0,1) 和 (0,−3),则得到直线
为 x=0。由于在此直线上恒有 PX=QX,因此可能的最小差值为 0。
输入解题思路,AI测评打分。不知道怎么写?