|
||||||||||
Rubik 2กม2กม2Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 327670/327670 K (Java/Others)Total Submission(s): 830 Accepted Submission(s): 335 Special Judge Problem Description Sonny is probably the only computer science Ph.D. student who cannot solve a Rubik's cube. One day, he came across a neat little 2กม2กม2 Rubik's cube, and thought, "Finally, here's a cube that's easy enough for me to do!" Nope, wrong! He got pwned, hardcore. How embarrassing.To ensure that this does not happen again, he decides to write a computer program to solve the cube. Then he had this brilliant idea: Why not have the students at the programming contest do the work instead? So, given an initial conguration of the 2กม2กม2 Rubik's cube, your task for this problem is to write a program that solves it. The mini-cube has 6 faces, each with 4 painted tiles on it. The faces are labeled Front (F), Back (B),Up (U), Down (D), Left (L), and Right (R), according to the diagram below. Each of the tiles on the faces can be colored Red (R), Green (G), Blue (B), Yellow (Y), Orange (O), or White (W), and there are exactly 4 instances of each color. The cube is considered solved when the colors of all tiles on each distinct face of the cube match. cube, in the directions illustrated below. Note that the back-down-left corner is fixed with respect to all valid transforms. Input You will be given maps of an "unwrapped" cubes showing colors on each of the faces, in the following format: Output For each cube, output on a single line a sequence of moves that will solve the cube. Output `X' for a turn about the X-axis, `Y' for a turn about the Y-axis, and `Z' for a turn about the Z-axis. Any sequence of moves (that is reasonably finite) which solves the given configuration will do. (After all, Sonny does need to execute your commands to verify that your program works!) A blank line will suffice for an input cube that is already solved. Sample Input
Sample Output
Source | ||||||||||
|