Complaints Pile Up
Time limit5sMemory limit512 MB
Find the largest integer volume V so that each speaker's Manhattan-distance sound range, with radius V times its size, never overlaps another speaker's range.
- Level
Hard8 of 10
- Topics
- Binary search, Geometry, Divide and conquer
- Solved
- No attempts yet
Problem
DJ Wookje wanted to show people how good his DJing was. At 3 a.m. he drove a supercar around the apartment complex and started spinning at full volume.
One speaker was not enough to reach artistic heights. So DJ Wookje decided to do wide-area DJing (wide-area dealing).
- The apartment complex is a 2D grid, and the distance between two points and is .
- DJ Wookje placed speakers, with the -th speaker at .
- Each speaker has a size. If the -th speaker has size and the volume is , its music can be heard at every point within distance of that speaker.
- The volume can only be set to whole numbers, and every speaker has the same volume.
- 『 Art is volume. 』
DJ Wookje keeps raising the volume and is getting closer to artistic heights. However, some people who do not appreciate art file complaints when they hear music from two or more speakers at once. So DJ Wookje decided to raise the volume as far as possible without any complaints. If the boundary of a sound range or a boundary point overlaps with another, the music does not count as overlapping.

Feel the art (volume) of DJ Wookje! How large can the art (volume) of DJ Wookje get?
Input
The first line contains the number of speakers .
The second line contains the sizes in order.
From the third line onward, the -th line contains the coordinates of speaker . No two coordinates are the same.
All input values are integers greater than or equal to 1.
Output
Print the maximum size of the art (volume) that DJ Wookje can reach.