QOJ.ac

QOJ

時間限制: 2.0 s 記憶體限制: 1024 MB 總分: 100 通信 可 Hack ✓

#18404. 危险数据

统计

Nežmah 先生开始担任 SOA 的特工。邪恶的 M 先生拥有一个由 $n + k$ 个互不相同的整数组成的秘密集合,而 SOA 已经查明了其中的 $n$ 个。Nežmah 目前身处 M 先生的秘密巢穴中,可以访问所有这 $n + k$ 个整数。然而,他只能记住 $k$ 个整数,并且他不知道 SOA 已经知道了哪 $n$ 个整数。请帮助 Nežmah 构造 $k$ 个整数(不一定来自 M 先生的集合)以便记忆,使得他返回后能够推断出 SOA 缺失的是哪 $k$ 个整数。

这是一个需要运行两次的题目。

在第一次运行中,输入会给出 $n$ 和 $k$,以及 $n + k$ 个不同的整数。你需要输出 $k$ 个整数。

在第二次运行中,输入会给出 $n$ 和 $k$,以及 $n$ 个整数,这 $n$ 个整数是第一次运行中给出的 $n + k$ 个整数的一个真子集(顺序可能会被打乱)。此外,输入还会以相同的顺序给出你在第一次运行中输出的 $k$ 个整数。你需要输出第一次输入中缺失的那 $k$ 个整数。

输入格式

在第一次运行中:

第一行包含单词 first 以及整数 $n$ 和 $k$ ($1 \le n \le 10^5$, $1 \le k \le 10$)。

第二行包含 $n + k$ 个整数 $a_i$,表示 M 先生集合中的元素 ($1 \le a_i \le 10^6$)。

在第二次运行中:

第一行包含单词 second 以及整数 $n$ 和 $k$。

第二行包含 $k$ 个整数,即你第一次运行时的输出。

第三行包含 $n$ 个整数 $b_i$,表示 SOA 已经查明的 M 先生集合中的元素 ($1 \le b_i \le 10^6$)。

输出格式

在第一次运行中,输出单行,包含 $k$ 个整数 $m_i$ ($0 \le m_i < 2^{20}$)。

在第二次运行中,输出单行,以任意顺序包含所需的 $k$ 个元素。

样例

输入样例 1

first 3 2
5 2 3 4 1

输出样例 1

12345 0

输入样例 2

second 3 2
12345 0
3 1 5

输出样例 2

4 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.