#1007
Unrated
LUNAPARK
시간 제한
2s
메모리 제한
64MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Author: Stjepan Glavina

Mirko has grown tired of all the books, so he decided to go to the amusement park with his friends, despite not liking roller coasters. While his friends are having the time of their lives riding the coasters, Mirko is sitting on a bench, waiting and thinking about the possible paths of the coasters. The amusement park’s area can be represented as a table of R rows by C columns. A roller coaster has to start from the upper left corner and end at the lower right corner of the table. Each cell can be visited at most once, but not all cells need to be visited. It can continue its path from the current cell to the adjacent one above, below, to the left, or to the right of it. Each cell has a positive integer value associated with it, specifying how amusing that cell is to visitors. The total amusement value of the coaster is the sum of amusement values of all cells that the coaster visits. Help Mirko determine any one of the most amusing coasters (ones with the maximum sum).

입력

The first line of input contains two integers R and C (2 ≤ R, C ≤ 1000), the dimensions of the table. Each of the next R lines contains C positive integers smaller than 1000, specifying the amusement values of the respective table cells.

출력

The first and only line of output must contain a sequence of letters with no blanks. The letters specify the sequence of directions that the coaster follows, starting from the upper left and ending at the lower right corner. The directions up, right, down, left are marked by letters ‘U’, ‘R’, ‘D’, ‘L’, respectively. Note: The solution isn’t guaranteed to be unique.

예제 입력 1

3 3
5 1 3
2 4 8
1 1 2

예제 출력 1

RRDLLDRR

예제 입력 2

2 2
2 1
3 4

예제 출력 2

DR
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.