Square Stamping
Time limit1sMemory limit2048 MB
Given n points lying on the lines y = -9999, 0, and 9999, find the fewest axis-parallel squares of side 10000 that cover all of them.
- Level
Medium6 of 10
- Topics
- Greedy, Dynamic programming, Sorting
- Solved
- No attempts yet
Problem
In the plane, there are points whose -coordinates are each one of , , or . Let be the set of these points. Your task is to enclose all points in with a minimum number of congruent axis-parallel squares of side length . Each square is a closed region, so it contains all points inside it and on its boundary.
Input
The first line contains an integer (), the number of points in . Each of the following lines contains two integers and , the coordinates of a point. Here and . All input points are distinct.
Output
Print one line containing the minimum number such that axis-parallel squares of side length have a union that encloses all points in .