아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

36 Puzzle

시간 제한2초메모리 제한64 MB

요약
36개의 서로 다른 문자와 숫자가 섞인 6x6 격자가 주어질 때, 행과 열을 순환 이동시켜 목표 배열로 만드는 이동 순서를 출력한다.
난이도

보통10점 중 5점

유형
시뮬레이션, 구현
정답자
아직 제출이 없습니다

문제

A 36-puzzle consists of 36 square tiles. These squares form one 6×66 \times 6 square. Each of the tiles is labeled with either a letter of the Latin alphabet or an Arabic digit. The objective of the game is to place the squares in the following order:

abcdef
ghijkl
mnopqr
stuvwx
yz0123
456789

This must be achieved by performing a sequence of moves. In each move, all squares in one row or column can be shifted cyclically. For example, in the above position, after shifting the first row by two positions to the right, one gets:

efabcd
ghijkl
mnopqr
stuvwx
yz0123
456789

Given some order of the squares, find any sequence of moves that achieves the desired order.

입력

The input consists of six lines. Each line contains six characters: lowercase letters or digits. The ii-th line describes labels on squares in the ii-th row. Each possible label will appear exactly once. You can assume that for the test data, there will be always exist a solution.

출력

Print the descriptions of moves. A description of a single move consists of the row or column number ii (1≤i≤61 \le i \le 6), the direction of the shift dd (dd should be "L" for shifting a row to the left, "R" for shifting a row to the right, "U" for shifting a column upwards or "D" for shifting a column downwards) and kk, the number of squares to shift by (1≤k≤51 \le k \le 5). Consecutive moves must be printed on separate lines.

예제1

  1. 예제 1

    입력
    bciefa
    ghojkl
    mnupqr
    st0vwx
    yz6123
    45d789
    
    예상 출력
    3 D 1
    1 R 1