QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#5056. 车

Statistics

Pang 教授正在与他的对手 Shou 教授下棋。他们是游戏中仅有的两名玩家。棋盘非常大,可以看作是一个二维平面。Pang 教授放置了 $n_1$ 个车,Shou 教授放置了 $n_2$ 个车。每个车都是棋盘上坐标为整数的一个点。如果两个车满足以下所有条件,则其中一个车会被另一个车攻击:

  • 它们由不同的玩家放置。
  • 它们具有相同的 $x$ 坐标或 $y$ 坐标。
  • 它们之间的线段上没有其他车。

请帮助 Pang 教授和 Shou 教授判断哪些车受到了攻击。

输入格式

第一行包含两个整数 $n_1, n_2$ ($1 \le n_1, n_2 \le 200000$),由一个空格分隔,分别表示 Pang 教授放置的车数和 Shou 教授放置的车数。

接下来的 $n_1$ 行中,第 $i$ 行 ($1 \le i \le n_1$) 包含两个整数 $x, y$ ($-10^9 \le x, y \le 10^9$),由一个空格分隔,表示 Pang 教授放置的第 $i$ 个车的位置 $(x, y)$。

接下来的 $n_2$ 行中,第 $i$ 行 ($1 \le i \le n_2$) 包含两个整数 $x, y$ ($-10^9 \le x, y \le 10^9$),由一个空格分隔,表示 Shou 教授放置的第 $i$ 个车的位置 $(x, y)$。

保证两位玩家放置的 $n_1 + n_2$ 个车的位置各不相同(即没有两个车位于相同的位置)。

输出格式

第一行输出一个长度为 $n_1$ 的字符串。如果 Pang 教授放置的第 $i$ 个车受到攻击,则第 $i$ 个字符应为 1,否则为 0。

第二行输出一个长度为 $n_2$ 的字符串。如果 Shou 教授放置的第 $i$ 个车受到攻击,则第 $i$ 个字符应为 1,否则为 0。

样例

输入 1

3 2
0 0
0 1
1 0
0 -1
-1 0

输出 1

100
11

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.