#P7249. [BalticOI 2012] 移动网络 (Day1)

[BalticOI 2012] 移动网络 (Day1)

Description

Given a line segment and several points, find the maximum possible distance from a point on the segment to its nearest point among the given points.

Input Format

The first line contains two integers nn and ll, meaning there are nn points in total, and the endpoints of the segment are (0,0)(0,0) and (l,0)(l,0).
Each of the next lines contains two integers (x,y)(x,y), describing the coordinates of a point. It is guaranteed that no two points have the same coordinates.
The points are given sorted in increasing order, with the xx-coordinate as the primary key and the yy-coordinate as the secondary key.

Output Format

Output the maximum distance.

This problem uses SPJ. Your answer is considered correct if the absolute error between your output and the standard answer does not exceed 10310^{-3}.

2 10
0 0
11 1
5.545455

Hint

Sample Explanation.

The point with the maximum distance lies at the intersection of the perpendicular bisector of two points and the line segment.

Constraints.

  • For 25%25\% of the testdata, n5000n \leq 5000.
  • For 50%50\% of the testdata, n105n \leq 10^5.
  • For 100%100\% of the testdata, 1n1061 \leq n \leq 10^6, 1l1091 \leq l \leq 10^9, 109xi,yi109-10^9 \leq x_i,y_i \leq 10^9.

Notes.

Translated from BalticOI 2012 Day1 T2. Mobile.

Translated by ChatGPT 5