Repair Depots
InterviewTime limit1sMemory limit128 MB
Place at most c depots anywhere in the plane to minimize the largest distance from any of n bots (n at most 16) to its nearest depot, and print that distance to six decimals.
- Level
Hard8 of 10
- Topics
- Binary search, Geometry, Brute force, Implementation
- Solved
- No attempts yet
Problem
RoboCorp Oregon has already deployed several of its PoliceBots across the state, and now they want to be able to repair a bot whenever it breaks. They will build only a limited number of repair depots, and they want to position those depots so that every bot is close to one of them.
You are given the locations of the deployed PoliceBots () and the maximum number of repair depots () that RoboCorp is willing to build. You may place each depot at any point in the plane (not only at a bot's location). Every bot is served by the depot nearest to it, and any bot can be repaired at any depot. Position at most depots so that the largest distance from any bot to its nearest depot is as small as possible, and report that minimum possible distance.
Input
The first line contains an integer (), the number of test cases.
Each test case begins with a line containing two integers and . The next lines each contain two space-separated real numbers and (), the Cartesian coordinates of one bot. Coordinates are real values; some may be written as integers.
Output
For each test case, print on its own line the minimum achievable value of the maximum bot-to-nearest-depot distance. Print the value with at least one digit before the decimal point and exactly six digits after it. Your answer must be within of the true result; the true result will never have a or a as its seventh digit after the decimal point, so rounding to six places is unambiguous.