Watson has built a robot that moves on a board. Holmes and Watson make a bet: arrange mirrors and walls so that the robot takes as long as possible to reach its finish cell.
The robot starts at the start cell, facing its specified initial direction. It repeatedly attempts to move one cell in its current direction. Its action depends on the cell ahead.
A mirror is either / or \. Flipping a mirror changes it to the other type. Reflection follows this table.
Mirror | Moving right | Moving down | Moving left | Moving up |
|---|---|---|---|---|
| Up | Left | Down | Right |
| Down | Right | Up | Left |
The incoming directions in the table are the directions the robot faces immediately before entering the mirror cell. A mirror flips only when the robot enters its cell. Reversing direction because of a wall while standing on a mirror does not flip that mirror.
Each move into an adjacent cell takes second. Direction changes take no time. The robot stops immediately upon reaching the finish.
Holmes has built a board that takes seconds. Help Watson build a board that beats Holmes. A valid board that falls short of this target can still earn partial credit.
The input consists of the single integer , as follows.
This value does not affect the board requirements and may be ignored. Submit a program that prints a board.
Print lines, each containing characters without spaces. The characters have the following meanings.
U, D, L, R: the start cell, initially facing up, down, left, or right, respectively.F: the finish cell..: an empty cell.#: a wall./, \: a mirror.There must be exactly one start character in the entire board and exactly one finish character. If there are multiple solutions, print any of them.
Scoring
A board is valid only if the robot reaches the finish without leaving the board, using at most moves. Incorrect formatting, an infinite loop, or failure to reach the finish within this movement limit earns points. Reversing direction at a wall does not count as a move.
U, D, L, R, F, ., #, /, and \.The robot moves two cells to the right and enters the mirror. It then faces down, but the wall below makes it turn around without moving. One upward move reaches the finish. The total is seconds, earning points. This example is valid but does not earn full credit.
For a valid board, let be the number of moves before reaching the finish. Its score is
A board with earns points and is accepted. Merely completing moves does not earn credit: the robot must actually reach the finish.