Editorial for Baltic OI '12 P2 - Mobile
Submitting an official solution before solving the problem yourself is a bannable offence.

You can get a very easy solution by noticing that the only relevant points of the highway are its endpoints and the intersections with the perpendicular bisectors of the line segments that connect pairs of distinct transceiver stations. Location of these points is
You can now calculate the distance from each of these points to the nearest transceiver. This solution takes
With some optimizations for finding the nearest station, you can improve the
performance to
DP solution that checks all distinct pairs of transceivers takes
A better solution is to do a binary search for the maximum distance of a point on
the highway to the nearest transceiver station. You will need
The best solution is the following: using a stack, you go through the transceivers
from left to right. You pop one element from it, if you can verify that it cannot be the
closet station for any point on the road. The sorting in the beginning takes
Comments