QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 32 MB Puntuación total: 10

#10666. 地图 [B]

Estadísticas

Jane 在地下室发现了一张她所在城镇的旧地图。这张地图是一张正方形的纸,被划分为若干单位正方形,上面标记着几个神秘的点。Jane 不知道这些点的含义,因此她决定访问每一个点。她决定与她的三位同事——Jack、Adam 和 Robert——在其中一个神秘点会合:这将是起点。之后,每个人将被分配一个区域,他们将在该区域内找到所有的神秘点并检查隐藏在其中的秘密。Jane 决定划分四个区域:第一个区域包含所有坐标均小于起点坐标的点,第二个区域包含所有坐标均大于起点坐标的点,第三个区域包含第一个坐标大于起点坐标而第二个坐标小于起点坐标的点,第四个区域包含第一个坐标小于起点坐标而第二个坐标大于起点坐标的点。最后,所有同事将一起访问那些第一个坐标或第二个坐标与起点坐标相等的标记点。

现在 Jane 只需要选择起点。起点的选择应满足:每个人都能独立地至少访问到一个神秘点。你能找出有多少个这样的起点吗?

输入格式

标准输入的第一行包含两个整数 $n$ 和 $d$ ($1 \le n \le 1\,000\,000$, $3 \le d \le 10^{9}$),分别表示地图上标记点的数量和地图的大小。接下来的 $n$ 行包含点的描述,每一行是一个整数对 $x_{i}, y_{i}$ ($0 \le x_{i}, y_{i} \le d$),表示第 $i$ 个点的坐标。输入中的所有点互不相同。

输出格式

标准输出的第一行且仅包含一行,输出一个整数,表示可以作为起点的点的数量。

样例

输入 1

6 5
0 0
1 4
2 2
3 2
4 4
5 1

输出 1

2

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.