QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 1024 MB Puntuación total: 100

#2947. Ball of Whacks

Estadísticas

Danny 有一个名为“Ball of Whacks”的新玩具。它是一个菱形三十面体(我们都知道这是一个三十面的多面体),由小的金字塔形碎片组成,看起来如下所示:

图 C.1:游戏碎片。

当所有 30 个碎片拼在一起时,它们形成了图 C.2a 所示的物体。图 C.2b–C.2f 展示了构建菱形三十面体的一种方法:底部是一个由五个金字塔组成的瓣状部分(C.2b —— 注意图中仅显示了每个金字塔碎片的底座);其上是另一个由五个碎片组成的环(C.2c);其上是一个由十个碎片组成的大环(C.2d),接着是一个五碎片环(C.2e)和另一个瓣状部分(C.2f)。图 C.3 包含了另外两个视图,展示了碎片之间是如何相互连接的。

图 C.2:Ball of Whacks 的构造。

图 C.3:已组装的 Ball of Whacks 的编号方案

Danny 有几个朋友也拥有 Ball of Whacks,当他们聚在一起时……嗯,球被拆散了。结果是地板上散落着许多大小和形状各异的部分。当要回家时,Danny 需要知道哪些部分可以拼在一起组成一个完整的 Ball of Whacks。他希望你帮帮他。

输入格式

输入文件包含三个 Ball of Whacks 部分的描述,每个描述占一行。每个描述以一个整数 $m$ 开头,表示该部分中金字塔形碎片的数量,随后是一组 1 到 30 之间的数字,表示该部分中金字塔碎片在图 C.2b-C.2f 所示编号位置中的相对排列。每个部分的描述都以位置 1 的碎片开始,尽管该碎片——以及该部分中的所有其他碎片——可能需要移动,以便所有三个部分能够拼合在一起。任何部分中的碎片都是连通的;也就是说,你可以通过穿过共享内部面的碎片,从该部分中的任何一个碎片到达任何其他碎片。

输出格式

如果这三个部分可以拼在一起组成一个完整的 Ball of Whacks,则输出 Yes,否则输出 No

样例

样例输入 1

25 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
3 1 2 3
2 1 2

样例输出 1

Yes

样例输入 2

24 1 4 5 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 25 26 27 30
5 1 2 3 4 5
1 1

样例输出 2

No

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.