QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 512 MB مجموع النقاط: 100

#11831. Shika Bika

الإحصائيات

Shika 和 Bika 是两个可爱的小姐妹。她们总是喜欢在一起玩。最近,她们在学习关于整数的知识。她们开发了以下游戏:Shika 选择一个特定的范围,但不告诉 Bika,然后游戏分轮进行。在每一轮中,Shika 从她选择的范围内喊出一个整数,然后 Bika 回复另一个整数(不需要在范围内,任何整数都可以)。只有在确保她喊出的范围内的每个整数至少被喊出过一次后,Shika 才会结束游戏。这意味着 Shika 可能会多次喊出同一个整数,而 Bika 每次回复的整数可能不同。例如,Shika 在一轮中喊出 3,Bika 回复 4,然后在另一轮中,Shika 再次喊出 3,Bika 这次回复 3。每一轮结束后,她们会记下一对整数,即 Shika 喊出的整数和 Bika 回复的整数。记录有以下问题:

  • 她们记录这对整数时没有特定的顺序。因此,如果 Shika 喊出 $x$,Bika 回复 $y$,她们有时会记作 $(x, y)$,有时记作 $(y, x)$。
  • 在某些轮次中,她们甚至忘记记录这对整数。

第二天游戏结束后,Shika 问 Bika 一些问题,例如:“我昨天喊出过整数 $q$ 吗?”。Bika 手里有记录,她可以回答以下答案之一:“YES”(是)、“NO”(否)或“NOT SURE”(不确定)。给定这些记录,你能帮 Bika 回答 Shika 的问题吗?

输入格式

程序将在一个或多个测试用例上进行测试。输入的第一行是一个整数 $T$ ($1 \le T \le 100$)。

每个测试用例代表一场游戏,并以一行包含两个空格分隔的整数开始:

  • $N$:记录的对数 ($1 \le N \le 1000$)
  • $Q$:查询次数 ($1 \le Q \le 1000$)

接下来 $N$ 行,每行包含两个空格分隔的整数 $a$ 和 $b$,表示第 $i$ 对记录 ($-1,000,000 \le a, b \le 1,000,000$)。

接下来 $Q$ 行,每行包含一个整数 $A$,表示第 $j$ 次查询 ($-1,000,000 \le A \le 1,000,000$)。

输出格式

对于每个测试用例,打印 $Q$ 行,其中第 $i$ 行用“YES”、“NO”或“NOT SURE”回答第 $i$ 个查询。

样例

输入格式 1

1
2 3
10 7
20 14
3
8
11

输出格式 1

NOT SURE
NOT SURE
YES

说明

在该测试用例中,我们可以看到有以下可能性:

  1. 第 1 轮:Shika 喊出 10,Bika 回复 7 第 2 轮:Shika 喊出 20,Bika 回复 14
  2. 第 1 轮:Shika 喊出 10,Bika 回复 7 第 2 轮:Shika 喊出 14,Bika 回复 20
  3. 第 1 轮:Shika 喊出 7,Bika 回复 10 第 2 轮:Shika 喊出 20,Bika 回复 14
  4. 第 1 轮:Shika 喊出 7,Bika 回复 10 第 2 轮:Shika 喊出 14,Bika 回复 20

对于第一个查询,Bika 永远无法确定 Shika 是否喊出了 3,因为有些轮次的记录可能丢失了。对于第二个查询,在可能性 1 和 2 中,Bika 无法保证 Shika 喊出了 8,因为 8 不在所有可能性中 Shika 喊出的整数之间。对于第三个查询,11 肯定被 Shika 喊出过,因为它位于所有可能性中 Shika 喊出的整数之间。

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.