QOJ.ac

QOJ

Limite de temps : 2 s Limite de mémoire : 64 MB Points totaux : 100

#12255. 36 拼图

Statistiques

36-puzzle 由 36 个方形瓷砖组成。这些瓷砖构成了一个 $6 \times 6$ 的正方形。每个瓷砖上都标有一个拉丁字母或阿拉伯数字。游戏的目标是将这些瓷砖按以下顺序排列:

abcdef ghijkl mnopqr stuvwx yz0123 456789

这必须通过执行一系列移动来实现。在每次移动中,可以将某一行或某一列的所有瓷砖进行循环移位。例如,在上述位置中,将第一行向右移动两个位置后,得到:

efabcd ghijkl mnopqr stuvwx yz0123 456789

给定瓷砖的某种排列,请找到任何能够达到目标顺序的移动序列。

输入格式

输入包含六行。每行包含六个字符:小写字母或数字。第 $i$ 行描述了第 $i$ 行瓷砖上的标签。每个可能的标签都会恰好出现一次。你可以假设对于测试数据,总是存在解。

输出格式

打印移动的描述。单次移动的描述由行号或列号 $i$ ($1 \le i \le 6$)、移动方向 $d$($d$ 应为 “L” 表示行左移,“R” 表示行右移,“U” 表示列上移,“D” 表示列下移)以及移动的瓷砖数量 $k$ ($1 \le k \le 5$) 组成。连续的移动必须打印在单独的行上。

样例

样例输入 1

bciefa
ghojkl
mnupqr
st0vwx
yz6123
45d789

样例输出 1

3 D 1
1 R 1

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.