logo AlgoBeat OnlineJudge
登录 注册

#214868. [ICPC 2024 Seoul R] Square Stamping

内存限制:2048 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

In the plane, there are points whose y-coordinates are either , , or . Let be the set of these points. Your task is to enclose all the points in by a minimum number of congruent axis-parallel squares of side length 10,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 (), representing the number of input points in . In each of the following lines, there are two integers and , representing the - and -coordinates of a point in , respectively, such that it holds that and . You may assume that all the 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 such that there exist axis-parallel squares of side length 10,000 whose union encloses all the input points in .

样例

样例输入 1

5
0 9999
0 0
0 -9999
200 0
10000 9999

样例输出 1

2

样例输入 2

5
10 -9999
0 0
3 9999
9000 -9999
10003 9999

样例输出 2

2

样例输入 3

6
10 -9999
0 0
3 9999
9000 -9999
10003 -9999
10003 9999

样例输出 3

3