PivotOJ

Square Stamping

시간 제한: 1000ms메모리 제한: 2048MB출처: ICPC Asia Seoul Regional 2024BOJ 32837

문제

In the plane, there are nn points whose yy-coordinates are either 9999-9999, 00, or 99999999. Let PP be the set of these nn points. Your task is to enclose all the points in PP by a minimum number of congruent axis-parallel squares of side length 1000010\,000. As a subset of the plane, each such square consists of all points inside and on the boundary.

입력

Your program is to read from standard input. The input starts with a line consisting of a single integer nn (1 ≤ n ≤ 300\,000), representing the number of input points in PP. In each of the following nn lines, there are two integers xx and yy, representing the xx- and yy-coordinates of a point in PP, respectively, such that it holds that -10^9 ≤ x ≤ 10^9 and y{9999,0,9999}y \in \{-9999, 0, 9999\}. You may assume that all the nn input points are distinct.

출력

Your program is to write to standard output. Print exactly one line. The line should consist of a single integer that represents the minimum possible number tt such that there exist tt axis-parallel squares of side length 1000010\,000 whose union encloses all the input points in PP.

예제

예제 1

입력
5
0 9999
0 0
0 -9999
200 0
10000 9999
출력
2

예제 2

입력
5
10 -9999
0 0
3 9999
9000 -9999
10003 9999
출력
2

예제 3

입력
6
10 -9999
0 0
3 9999
9000 -9999
10003 -9999
10003 9999
출력
3
코드를 제출하려면 로그인하세요.