No.585 A Puzzle Without Ingenuity
タグ : / 解いたユーザー数 13
作問者 :
nmnmnmnmnmnmnm
Note
At the writer's request, this problem has no tester.Problem Statement
Yuki has obtained a puzzle with 4 rows and 4 columns, whose completed state is shown below.
ABCD EFGH IJKL MNOP
However, the puzzle he obtained was not completed.
The following operations can be performed on the puzzle.
・In one operation, you can $Rotate$ a chosen row $r$ to the right by $a$.
・In one operation, you can $Rotate$ a chosen column $c$ downward by $b$.
Yuki must prepare a procedure of at most 100 operations that makes this puzzle identical to the completed state.
It is guaranteed that the puzzle Yuki obtained can be made identical to the completed state within 100 operations.
Input
$S_0$ $S_1$ $S_2$ $S_3$
$S_i$ holds the information on the letters of the panels in row $i$. ($i$ is 0-indexed)
Each string $S_i$ always consists of 4 characters.
In row $i$, the $j$-th character is the character in column $j$. ($j$ is 0-indexed)
The letters in the puzzle are the 16 uppercase letters from 'A' to 'P', with no duplicates.
It is guaranteed that the puzzle given in the input can be completed within 100 operations.
Since the puzzle is not completed, the completed state is never given as input.
Output
First, output the required number of operations $N$ on one line. $N$ is an integer. $1 \le N \le 100$.
Then, output the operations on $N$ lines, one line for each required operation, in order starting from the first operation.
For a column operation,
R r a
output, on one line separated by spaces, the uppercase letter 'R', the integer r representing column $r$, and the integer a representing a $Rotate$ to the right by $a$, as shown above.
$0 \le r \le 3$. $1 \le a \le 3$.
For a column operation,
C c b
output, on one line separated by spaces, the uppercase letter 'C', the integer c representing column $c$, and the integer b representing a $Rotate$ downward by $b$, as shown above.
$0 \le c \le 3$. $1 \le b \le 3$.
Note that if the numeric values do not satisfy these constraints, your output will be judged as incorrect.
Any procedure that completes the puzzle is accepted as long as the conditions are satisfied.
Sample
Sample 1
Input
BCDA EFGH IJKL MNOP
Output
1 R 0 1
The puzzle is completed by applying $Rotate$ to row 0 to the right by 1.
Sample 2
Input
ANCD EBGH IFKL MJOP
Output
1 C 1 3
The puzzle is completed by applying $Rotate$ to column 1 downward by 3.
Sample 3
Input
FHLE MOIC DNPB AKGJ
Output
14 C 0 2 C 3 1 R 1 3 C 3 2 R 2 1 R 1 2 C 2 2 R 0 1 R 0 3 R 0 2 C 3 1 R 0 1 C 1 3 R 2 1
This is not the shortest solution, but any procedure that completes the puzzle within 100 operations is accepted.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。