#P7569. 「MCOI-05」粘液
「MCOI-05」粘液
Description
Bookworm has a tunneling machine and a piece of land divided into cells. He plans to level this land using the tunneling machine. Formally, he needs the tunneling machine to pass through every cell exactly once.
This seems easy. However, the implementation of the tunneling machine's program has some glitches. When the tunneling machine moves continuously in the same direction for exactly steps, it will get stuck and keep dropping TNT onto the same place.
Note: placing the tunneling machine at the beginning does not count as a move. In other words, the tunneling machine should move times.
Bookworm does not want to be blasted into the sky like the poor namespace_std, so he hopes to find a way to arrange the tunneling machine's route so that it will not get stuck.
Input Format
Input one line with three integers , representing the land's length and width, and the value in the tunneling machine program.
Output Format
If there is a valid plan, output three lines:
- The first line outputs a string
YES. - The second line outputs a string of length consisting only of
L,R,D,U, representing the direction of each move. - The third line outputs two integers , meaning the starting point of the designed route is , i.e., row and column . If there are multiple possible answers, Bookworm may output any one of them.
Otherwise, output only one line NO.
Please note that the output may be large. Use a fast output method.
3 3 2
NO
3 3 3
YES
RDLDRRUU
1 1
6 4 4
YES
RRRDLLLDRRRDLLLDRRRDLLL
1 1
1 1 2000
YES
1 1
Hint
Constraints
This problem uses bundled testdata.
- Subtask 0 (1 pts): Sample. You can know whether your answer passes the
Special Judgeby submitting the output. - Subtask 1 (9 pts): .
- Subtask 2 (15 pts): .
- Subtask 3 (5 pts): .
- Subtask 4 (15 pts): .
- Subtask 5 (20 pts): .
- Subtask 6 (10 pts): A valid solution is guaranteed to exist.
- Subtask 7 (25 pts): No special restrictions.
For of the data, .
Translated by ChatGPT 5
京公网安备 11011102002149号