QOJ.ac

QOJ

حد الوقت: 1.0 s حد الذاكرة: 1024 MB مجموع النقاط: 100 قابلة للهجوم ✓

#11497. 为空投感到焦虑

الإحصائيات

有一款名为“Well-known problemgrounds”的新游戏。在这个游戏中,有 $n$ 个人站在二维网格上,希望能解决一些问题。

游戏过程如下:在某个时刻,裁判在棋盘上的某处召唤一个空投。空投中包含一道知名问题的题目。玩家们立即以每秒 1 个格子的恒定速度冲向空投地点,渴望解决任务(并徒劳地希望获得一些新思路)。然而,他们只能水平或垂直移动。

更具体地说,他们都遵循同一个算法:在任何一秒,如果他们的列与空投的列不同,他们就会向空投所在列的方向水平移动。如果空投在同一列,他们就会向空投的方向垂直移动。第一个到达空投的玩家(或多名玩家)会停下来,并在 1 秒内解决任务(其他玩家在这一秒内会继续向空投移动),并向其他人宣布。此时,所有人都会停下来,开始等待下一个空投的部署。

作为裁判,你构思了 $n - 1$ 个问题,并希望以某种方式部署其中一些问题,使得最终所有玩家都能聚集在同一个地方。你知道每个玩家的起始位置。请决定在哪里部署空投以实现你的目标。

输入格式

第一行包含一个整数 $1 \le n \le 5000$,表示玩家人数。接下来的 $n$ 行,每行包含两个整数 $x_i, y_i$ ($-10^8 \le x_i, y_i \le 10^8$),表示第 $i$ 个玩家的初始坐标。

输出格式

在输出的第一行打印一个整数 $0 \le k \le n - 1$,表示部署的空投数量。然后输出 $k$ 行,每行包含两个整数 $x$ 和 $y$ ($-10^8 \le x, y \le 10^8$):第 $i$ 行应包含第 $i$ 个空投部署点的坐标。如果存在多种可能的答案,输出其中任意一个即可。特别地,你不需要最小化 $k$。

样例

输入 1

2
0 0
4 5

输出 1

1
4 0

输入 2

8
3 4
4 3
-3 4
4 -3
-3 -4
-4 -3
3 -4
-4 3

输出 2

1
0 0

说明

在第一个样例中,玩家与空投位置的距离分别为 4 和 5。第一个玩家将最先到达该地点,但由于他需要 1 秒来解决任务,第二个玩家也会到达该地点。

在第二个样例中,所有玩家距离空投的距离均为 $3 + 4 = 7$,因此每个人都会同时到达。

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.