QOJ.ac

QOJ

时间限制: 1.0 s 内存限制: 2048 MB 总分: 100

#10597. 恶棍

统计

Ashley 和 Brandon 正在玩一款热门的新卡牌游戏:Ruffians!

在 Ruffians 中,十张牌被分发成一个两行五列的网格。每张牌上都有一个 1 到 9 之间的数字。Ashley 和 Brandon 都在寻找一对数字相同的牌。

玩了一段时间后,他们意识到总能找到一对数字相同的牌。为了增加游戏难度,他们要求找到一对数字相同且位于不同行、不同列的牌。

给定一种牌的排列方式,判断是否存在这样的一对牌。

输入格式

第一行包含一个整数 $t$ ($1 \le t \le 10^3$),表示测试用例的数量。

每个测试用例由两行组成。

每个测试用例的第一行包含五个整数,每个整数在 1 到 9 之间。第二行也包含五个整数,每个整数在 1 到 9 之间。这两行共同构成了两行五列的卡牌网格。

输出格式

输出 $t$ 行,每行对应一个测试用例。

对于每个测试用例,如果存在一对数字相同且位于不同行、不同列的牌,输出 YES。否则,输出 NO

样例

样例输入 1

3
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
2 6 7 8 9
5 5 5 5 5
5 5 5 5 5

样例输出 1

NO
YES
YES

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.