시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 1024 MB | 0 | 0 | 0 | 0.000% |
You are given a rectangular grid consisting of r × c points. The lower left corner has coordinates (1,1), the upper right corner has coordinates (c,r). The neighbors of a point (x,y) are the points (x − 1,y), (x + 1,y), (x,y − 1), and (x,y + 1), if they exist. A path is a sequence of points such that subsequent points are neighbors and each point appears on the path at most once.
Given two distinct points (xs,ys) and (xf,yf), find one longest path from (xs,ys) to (xf,yf).
The first line of the input file contains an integer t specifying the number of test cases. Each test case is preceded by a blank line.
Each test case consists of a single line with six integers – r, c, xs, ys, xf, yf.
You may assume that 1 ≤ r,c ≤ 100 and rc ≥ 2.
For each test case, output a single string describing one possible longest path. If there are multiple longest paths, output any one of them.
A path a1,a2,…,ak is described by a string consisting of k − 1 letters U, D, L, R. The i-th letter in the string describes the move from point ai to ai+1:
번호 | 배점 | 제한 |
---|---|---|
Easy | 1 | r ≤ 5. |
Hard | 2 |
2 1 10 2 1 4 1 3 3 1 1 2 2
RR RRUULLDR
first example:
second example: