QOJ.ac

QOJ

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

#4481. 3D 拼图

الإحصائيات

Klee 喜欢玩具。Klee 的妈妈 Alice 从须弥给她买了一个新玩具。 这个玩具是一个 $4 \times 4 \times 4$ 的立方体。该立方体可以被分割成 13 个不同的部分。 这 13 个积木块如图所示。

每个积木块都可以放置在立方体内的任何位置,但不能重叠。 Klee 可以自由旋转积木块,并使用一种魔法——镜像魔法。使用镜像魔法后,积木块会进行对称翻转。例如,图中展示了积木块 F 使用镜像魔法后的样子。

起初,Alice 已经放置了一些积木块。Klee 需要将剩余的积木块放入 $4 \times 4 \times 4$ 的立方体中。 通过占星术,Alice 得知解的数量不会超过 500。 Klee 想知道这个拼图的所有解,但这对她来说太难了。请帮助她。

输入格式

每个测试包含多个测试用例。第一行包含测试用例的数量 $T$ ($1 \le T \le 10$)。 接下来是各测试用例的描述。 每个用例包含 16 行。每行包含一个长度为 4 的字符串。每 4 行描述立方体从上到下的一层。 每个输入字符只能是 "A" 到 "M" 的大写字母或 "."。 "A" 到 "M" 表示上图中的积木块,"." 表示该位置为空。

输出格式

对于每个测试用例: 如果无法解出该拼图,请在单行中输出 "No Solution!"(不含引号)。 否则,在第一行输出解的数量。 然后对于每个解,输出 16 行。每行包含一个长度为 4 的字符串。每 4 行描述立方体从上到下的一层。 每个输出字符只能是 "A" 到 "M" 的大写字母,表示上图中的积木块。 积木块的输出格式与输入相同。 如果有多个解,请按字典序输出。

样例

样例输入 1

2
E...
EEE.
E...
...L
E...
....
....
...L
JJ..
GJ..
GII.
HIIL
JJ..
JJ..
GII.
HIIM
E...
EEE.
E...
...L
E...
....
....
...L
JJ..
GJ..
G...
H..L
JJ..
JJ..
G...
H..M

样例输出 1

1
ECCC
EEEC
EDDD
BDDL
ECKK
AAAA
BDDA
BBBL
JJKK
GJFA
GIIA
HIIL
JJKK
JJFF
GIIF
HIIM
2
ECCC
EEEC
EDDD
BDDL
ECKK
AAAA
BDDA
BBBL
JJKK
GJFA
GIIA
HIIL
JJKK
JJFF
GIIF
HIIM
EKKK
EEEA
EBBA
DDBL
EKKK
AAAA
DDBA
DDDL
JJII
GJII
GFBC
HFFL
JJII
JJII
GCCC
HCFM

说明

第一个样例的 3D 模型。 下载并用画图 3D 打开。 https://share.weiyun.com/5iX1150Z

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.