John, a research scholar / Professor / Puzzle solver wants your help in publishing his work on SudoKube on his online blog for his followers and students. A SudoKube is a mixture of Rubics cube and Sudoku. A SudoKube has exactly 6 appearances of every digit from 1 to 9 across the cube, whereas Rubics cube has 6 different colours. As John wants to publish his work in text /document form (no video) he's concerned how he would depict the step by step work of rotation in 2D form. Following are the notions and concepts John follows: 1. The six faces of the cube are named FRONT, BACK, UP, DOWN, LEFT and RIGHT respectively. 2. Just like a Rubics cube which move in 90 and 180 degrees in both clockwise and anti clockwise directions, so can the SudoKube 3. Any given face of the cube is a 3x3 square matrix whose indices are denoted by (0,0) to (2,2). Diagram below illustrates the same. 4. An elementary move is denoted in the following fashion. i. If a given face is rotated by 90 degrees clockwise about the axis passing from the centre of the face to the centre of the cube, the move is denoted by the first letter of the name of the face. ii. If the rotation is anticlockwise by 90 degrees, the letter is followed by an apostrophe ('). iii. If the rotation is by 180 degrees, the letter is followed by a 2.
Answers
Answer:
The first eighteen lines of input include the values of the SudoKube faces in the order listed below D D D D D D D D D U U U U U U U U U L L L L L L L L L F F F F F F F F F R R R R R R R R R B B B B B B B B B
- where D denotes the lower face, U the upper face, L the left face, F the front face, R the right face, and B the back face.
- In summary, the state of the SudoKube is represented by the first eighteen lines, the operation to be done on that state is represented by the 19th line, and the output should be the resultant state. Output
- Make a 3x3 matrix that corresponds to the order (D, U, L, F, R, B). There should be a new line between each 3x3 matrix.
Examples:
Example 1
Input 4 7 1 2 8 7 6 3 5 5 8 3 3 1 6 9 4 2 5 2 4 3 7 8 5 1 9 6 1 4 9 4 8 2 5 7 7 9 1 1 9 6 6 2 8 8 6 3 7 2 5 3 9 4 F
Output 6 1 7 2 8 7 6 3 5
5 8 3 3 1 6 9 8 4
5 2 4 3 7 7 5 1 1
2 9 6 5 4 1 7 8 4
9 9 1 4 9 6 2 2 8
8 6 3 7 2 5 3 9 4
Explanation:
The output shows the state of SudoKube when the front side is rotated clockwise 5 8 3 3 1 6 9 4 2
5 2 4 6 1 4 7 9 1 8 6 3 3 7 8 9 4 8 1 9 6 7 2 5 5 1 9 2 5 7 6 2 8 3 9 4
4 7 1
2 8 7
6 3 5
5 8 3
3 1 6
9 8 4
5 2 4 2 9 6 9 9 1 8 6 3 3 7 7 5 4 1 4 9 6 7 2 5 5 1 1 7 8 4 2 2 8 3 9 4
6 1 7
2 8 7
6 3 5
#SPJ3
An elementary move is denoted in the following fashion. i. If a given face is rotated by 90 degrees clockwise about the axis passing from the centre of the face to the centre of the cube, the move is denoted by the first letter of the axis.
SudoKube is a mixture of Rubics cube and Sudoku. A SudoKube has exactly 6 appearances of every digit from 1 to 9 across the cube, whereas Rubics cube has 6 different colours. As John wants to publish his work in text /document form (no video) he's concerned how he would depict the step by step work of rotation in 2D form.
#SPJ3