#P6505. Maximize Nearest Distance in a Rectangle
Maximize Nearest Distance in a Rectangle
Maximize Nearest Distance in a Rectangle
Given a rectangle with its lower‐left corner at ((0,0)) and its upper–right corner at ((w, h)), and having (n) known points ( (x_i,y_i) ) inside (or on the boundary) of the rectangle, find a point (P) inside the rectangle which maximizes the distance to its nearest known point. In other words, if (d(P)=\min_{1\le i\le n}\sqrt{(x - x_i)^2+(y-y_i)^2}), then find (P) that maximizes (d(P)). Output the maximum possible value of (d(P)) as a floating point number.
Note: The sides of the rectangle are parallel to the coordinate axes. The answer will be accepted if it is correct within an absolute or relative error of 1e-6.
inputFormat
The input is given as follows:
- The first line contains two floating-point numbers \(w\) and \(h\) representing the upper–right corner of the rectangle (the lower–left corner is \((0,0)\)).
- The second line contains an integer \(n\) representing the number of known points.
- Each of the following \(n\) lines contains two floating-point numbers \(x_i\) and \(y_i\) representing the coordinates of the \(i\)-th point.
outputFormat
Output a single floating-point number: the maximum distance from a point in the rectangle to its closest known point. The answer is accepted if it has an absolute or relative error of at most 1e-6.
sample
10 5
2
1 1
9 4
4.123105625617661