CF811D.Vladik and Favorite Game
提高+/省选-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
This is an interactive problem.
Vladik has favorite game, in which he plays all his free time.
Game field could be represented as n × m matrix which consists of cells of three types:
- «.» — normal cell, player can visit it.
- «F» — finish cell, player has to finish his way there to win. There is exactly one cell of this type.
- «*» — dangerous cell, if player comes to this cell, he loses.
Initially player is located in the left top cell with coordinates (1, 1).
Player has access to 4 buttons "U", "D", "L", "R", each of them move player up, down, left and right directions respectively.
But it’s not that easy! Sometimes friends play game and change functions of buttons. Function of buttons "L" and "R" could have been swapped, also functions of buttons "U" and "D" could have been swapped. Note that functions of buttons can be changed only at the beginning of the game.
Help Vladik win the game!
这是一个交互式问题。
弗拉迪克有一款他最喜欢的、花费所有空闲时间游玩的游戏。
游戏区域可表示为一个 n×m 的矩阵,其中包含三类单元格:
- «.» — 普通单元格,玩家可以进入;
- «F» — 终点单元格,玩家必须抵达此处才能获胜;整个矩阵中恰好存在一个此类单元格;
- «*» — 危险单元格,若玩家进入该单元格,则立即失败。
初始时,玩家位于左上角坐标为 (1,1) 的单元格。
玩家可使用四个按钮:“U”、“D”、“L”、“R”,分别使玩家向上、向下、向左、向右移动。
但事情并非如此简单!有时朋友们会一起玩游戏,并交换按钮的功能:按钮“L”和“R”的功能可能被互换,同样地,“U”和“D”的功能也可能被互换。注意:按钮功能的交换仅在游戏开始时发生一次。
请帮助弗拉迪克赢得这场游戏!
输入格式
First line contains two space-separated integers n and m (1 ≤ n, m ≤ 100) — number of rows and columns respectively.
Each of next n lines contains m characters describing corresponding row of field. Set of characters in field is described above.
Guaranteed that cell with coordinates (1, 1) is normal and there is at least one way from initial cell to finish cell without dangerous cells.
第一行包含两个以空格分隔的整数 n 和 m(1≤n,m≤100),分别表示行数和列数。
接下来的 n 行中,每行包含 m 个字符,用于描述场地的对应行。场地中可能出现的字符集合如上所述。
保证坐标为 (1,1) 的格子是普通格子,且从起始格子到终点格子至少存在一条不经过危险格子的路径。
输入输出样例
输入#1
4 3 ... **. F*. ... 1 1 1 2 1 3 1 3 2 3 3 3 4 3 4 2 4 1 3 1
输出#1
R L L D U U U R R D
说明/提示
In first test case all four directions swapped with their opposite directions. Protocol of interaction In more convenient form:

This test could be presenter for hack in following way:
4 3 1 1
...
**.
F*.
...
在第一个测试用例中,四个方向均与其相反方向互换。交互协议的更直观形式如下:

该测试可用如下方式构造为针对某解法的 Hack 数据:
4 3 1 1
...
**.
F*.
...
输入解题思路,AI测评打分。不知道怎么写?