Koto Distance
Time limit2sMemory limit512 MB
Given N access points, each covering points whose Koto distance (the minimum of the x-gap and y-gap) is at most w_i, decide whether their union covers the whole W by H rectangle.
- Level
Hard8 of 10
- Topics
- Geometry, Sorting, Intervals, Union-find
- Solved
- No attempts yet
Problem
Koto is a well-known city laid out on a grid. The city occupies a rectangular area that extends meters from east to west and meters from north to south. The point meters from the west edge and meters from the south edge is written . The people of this city value their own culture handed down from long ago, and one part of it is an unusual distance measure called the Koto distance. The Koto distance between two points and is defined as .
Recently a plan was launched to make Wifi available throughout the city. The current plan calls for building access points. The -th access point is installed at the point and provides Wifi to the region whose Koto distance from it is at most .
Determine whether Wifi can be provided to the entire interior and boundary of the city if the access points are built as planned.
Keep it between us, but the Koto distance generally does not satisfy the triangle inequality, so it does not satisfy the axioms of a metric.
Input
The input is given in the following format.
Output
If Wifi can be provided to the entire interior and boundary of the city, output “Yes”; otherwise, output “No”.
Constraints
- No two access points share the same coordinates