KOSTA
Time limit5sMemory limit256 MB
Place one or two machines on given restaurant sites to minimize the farthest Manhattan delivery distance, and report that distance with the chosen sites.
- Level
Medium7 of 10
- Topics
- Binary search, Geometry
- Solved
- No attempts yet
Problem
Grill master Kosta opened restaurants in Manhattan at integer coordinates. The distance between restaurants and is . Kosta will install at most burger machines ( is or ) in existing restaurants and deliver burgers each morning from the nearest machine. For restaurant , let be the distance to the closest machine. Minimize the maximum . Both machines may be placed in the same restaurant. Output the minimum possible and the chosen restaurant numbers.
Input
The first line contains (). The second line contains . Each of the next lines has coordinates and (). No two restaurants share a point.
Output
Print the minimum possible on the first line. On the second line print restaurant numbers separated by spaces.