Three Squares
Time limit1sMemory limit256 MB
Given N integer points, find the smallest side length L so that three equal axis-parallel squares of side L can cover every point.
- Level
Hard8 of 10
- Topics
- Binary search, Sorting, Greedy, Divide and conquer
- Solved
- No attempts yet
Problem
There are distinct points in the plane, and every point has integer coordinates. Place three axis-parallel squares of the same side length so that each of the points lies inside one of the squares or on its border. Find the smallest side length for which this is possible.
The squares can be placed anywhere in the plane, and they can overlap.
Input
The first line contains the number of points ().
Each of the next lines contains the and coordinates of one point, separated by a space (). All points are distinct.
Output
Print, on one line, the smallest side length of three equal squares that cover all points. This value is always an integer.
Hint
In the first example, three squares of side length 2 with bottom left corners at , , and cover all five points.