Antenna
Time limit5sMemory limit32 MB
Find the minimum enclosing circle radius squared, as an exact fraction, for the smallest circle covering at least K of N given points.
- Level
Hard8 of 10
- Topics
- Geometry, Binary search, Brute force
- Solved
- No attempts yet
Problem
A telecommunications company is building a wireless network in a city. To satisfy its contract, the signal must reach at least of the city's households. Because the cost grows with the antenna's range, the company wants to place a single antenna so that the range needed to cover at least households is as small as possible.
There are households, each at integer coordinates. The antenna may be placed at any point of the plane (its coordinates need not be integers), and its range may be any positive real number . A household is covered when its Euclidean distance to the antenna is at most .
Given the households and the integer , determine the smallest range that lets a single antenna cover at least households.
Input
The first line contains two integers and () — the number of households and the minimum number that must be covered.
Each of the next lines contains two integers and () — the coordinates of one household. No two households share the same coordinates.
Output
Let be the smallest range that allows at least households to be covered. The value is always rational, because the optimal circle is fixed either by two households lying on a diameter or by three households lying on its boundary.
Output as an irreducible fraction in the form p/q, where and are integers, , and . Always print the denominator explicitly (for example, write 5/1 when ).
Note
The figures below illustrate how a single circle of the minimum range covers the required households.

