#P15860. [蓝桥杯第二届国际赛] 战线

    ID: 19915 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 显示难度提高+/省选− 上传者: 标签>计算几何2018Special Judge凸包蓝桥杯国赛

[蓝桥杯第二届国际赛] 战线

Problem Description

Country A and Country B are at war. The war is extremely brutal, and both countries are deeply short of resources, so they decide to hold peace talks.

An important part of the talks is to determine the border between the two countries. On a plane, the military centers of Country A and Country B are located at A=(XA,YA)A=(X_A, Y_A) and B=(XB,YB)B=(X_B, Y_B). There are also nn landmark buildings on the plane, located at (x1,y1),(x2,y2),…,(xn,yn)(x_1, y_1), (x_2, y_2), \ldots, (x_n, y_n).

For convenience of construction, they plan to choose the line segment connecting two landmark buildings as the border. However, both sides suspect that the other side might secretly restart the war after the treaty is signed. Clearly, if at some point on the border, the difference between its distances to the two military centers is too large, then the side that is closer can quickly dispatch troops from its military center to attack that point, while the farther side will need much more time to reinforce it. Therefore, they define the danger value of a border as the maximum, over all points on this border, of the absolute difference between the distances from that point to the two military centers (that is, for each point XX on the line segment, take ∣AX−BX∣|AX-BX|, and then take the maximum over all such XX).

Both countries want to choose a border with the minimum possible danger value. But their large electronic devices (such as supercomputers capable of 101000010^{10000} operations per second) were mostly destroyed in the war, leaving only ordinary computers that can perform about 10810^8 to 101010^{10} operations per second. The high command also does not want to wait too long. You, as the widely recognized top algorithm expert at the time, are asked to solve this problem quickly. You only need to compute this minimum danger value.

Input Format

The first line contains five integers n,XA,YA,XB,YBn, X_A, Y_A, X_B, Y_B.

The next nn lines each contain two integers. The ii-th line gives xi,yix_i, y_i.

Output Format

Output one floating-point number in one line, representing the minimum danger value. The error must not exceed 10−610^{-6}. You may output more or fewer than 66 digits after the decimal point.

3 -5 0 5 0
2 1
1 0
2 2
7.2111025509

Hint

Constraints

For all data, 1≤n≤1000001 \le n \le 100000, and the absolute values of all coordinates are at most 10910^9.

Translated by ChatGPT 5