![]() |
||||||||||
|
||||||||||
3D PuzzlesTime Limit: 8000/4000 MS (Java/Others) Memory Limit: 524288/262144 K (Java/Others)Total Submission(s): 53 Accepted Submission(s): 11 Problem Description Klee likes toys. Klee's mom, Alice bought her a new toy from Sumeru. The toy is a $4\times 4\times 4$ cube. The cube can be divided into $13$ different parts of the blocks. The $13$ blocks are shown in the figure. ![]() Each block can be placed anywhere in the cube, but cannot overlap. Klee can freely rotate the blocks and use a kind of magic, mirror magic. After using mirror magic, the blocks will flip symmetrically. For example, block F is shown in the figure after using mirror magic. ![]() At the beginning, Alice has put some blocks in place. Klee needs to put the remaining blocks into a $4\times 4\times 4$ cube. Using Astrology, Alice knew the number of solutions will not exceed $500$. Klee wants to know all the solutions of this puzzle, but it is too difficult for Klee. Please help her. Input Each test contains multiple test cases. The first line contains the number of test cases $T(1 \le T \le 10)$. Description of the test cases follows. There are $16$ lines in a case. Each line contains a string of $4$ characters. Every $4$ lines describe one layer of the cube from top to bottom. Each input character may only be upper-case letters from "A" to "M" or ".". "A" to "M" are indicating the blocks in the figure above and "." are indicating the position is empty. Output For each test case: If it's impossible to solve the puzzle, print "No Solution!" in a single line (without quotes). Otherwise, print the number of solutions in the first line. Then for each solution, print $16$ lines. Each line contains a string of $4$ characters. Every $4$ lines describe one layer of the cube from top to bottom. Each input character may only be upper-case letters from "A" to "M", indicating the blocks in the figure above. The output format of block is the same as input. If there are multiple solutions, print them in the lexicographical order. Sample Input
Sample Output
Hint 3D Model for the first example. Download and open it with paint 3D. https://share.weiyun.com/5iX1150Z Source | ||||||||||
|