#P5549. Minimum Telescope Radius for Observing Stars
Minimum Telescope Radius for Observing Stars
Minimum Telescope Radius for Observing Stars
EI is using his telescope to observe stars. There are \(n\) stars in the sky, each located at a 2D coordinate \((x,y)\). When the telescope is positioned at \((x_0,y_0)\), it can see all stars satisfying the inequality
\[
(x_0 - x)^2 + (y_0 - y)^2 \le r^2
\]
where \(r\) is an adjustable radius.
EI wants to know: if he wishes to see at least \(m\) stars, what is the minimum \(r\) he must set? You are allowed to choose the optimal telescope position.
Note: All formulas are in \(\LaTeX\) format. The answer should be printed as a floating point number with 6 decimal places.
inputFormat
The first line contains two integers \(n\) and \(m\) (\(1 \le m \le n\)). The next \(n\) lines each contain two real numbers \(x\) and \(y\) representing the coordinates of a star.
outputFormat
Output a single floating-point number: the minimum radius \(r\) required so that there is a circle of radius \(r\) (positioned arbitrarily) that covers at least \(m\) stars. The answer must be printed with 6 decimal places.
sample
3 2
0 0
1 0
0 1
0.500000