QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#394538#7751. Palindrome Path_happy_WA 2ms5896kbC++143.3kb2024-04-20 15:52:572024-04-20 15:52:58

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3712kb

input:

2 2
11
11
1 1 2 2

output:

DRUDLUULDURD

result:

ok Valid Solution (Length = 12).

Test #2:

score: 0
Accepted
time: 1ms
memory: 3680kb

input:

2 2
10
01
1 1 2 2

output:

-1

result:

ok No Solution.

Test #3:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

1 1
1
1 1 1 1

output:


result:

ok Valid Solution (Length = 0).

Test #4:

score: 0
Accepted
time: 1ms
memory: 3780kb

input:

5 4
1111
1111
1111
1111
1111
4 2 4 2

output:

ULDDDDRUURDDUUUUDDLDDLLUUUUDDDDRUUUURDDRUUUURDDDDUUUULLDDLDDUUUUDDRUURDDDDLU

result:

ok Valid Solution (Length = 76).

Test #5:

score: 0
Accepted
time: 0ms
memory: 3716kb

input:

5 5
11111
10101
11111
10101
11111
1 4 5 5

output:

DDDDRRUULRUURRDDLRDDLRUUUULLLRDDDDLLUUUUDDDDRRUUUURRDDDDUUUULLDDDDRLLLUUUURLDDRLDDRRUURLUURRDDDD

result:

ok Valid Solution (Length = 96).

Test #6:

score: 0
Accepted
time: 0ms
memory: 3680kb

input:

5 3
111
100
111
001
111
4 3 3 2

output:

RDDLLRRUULLUURRLLDDRRDDLLRRUULLUURRLLDDR

result:

ok Valid Solution (Length = 40).

Test #7:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

5 4
1001
1101
1111
0011
0010
2 2 1 1

output:

UULLULDDDUUURUDDRDURDDUUDLULUUDDRRDDUULULDUUDDRUDRDDURUUUDDDLULLUU

result:

ok Valid Solution (Length = 66).

Test #8:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

5 3
101
111
100
111
100
4 1 2 2

output:

RDUUULLRRUDDDLLDURRDLUUUURDLLDRUUUULDRRUDLLDDDURRLLUUUDR

result:

ok Valid Solution (Length = 56).

Test #9:

score: 0
Accepted
time: 1ms
memory: 3744kb

input:

5 5
01110
10110
11110
11011
11100
2 4 5 1

output:

DDLLDDRLLUUULRDDDRUURUULRDDRDUUUDDDLUUULDDLDDLUUULDDDRDDDUUUDRRUUDDUURRDUUUDDDRDDDLUUULDDLDDLUUULDDDUUUDRDDRLUURUURDDDRLUUULLRDDLLDD

result:

ok Valid Solution (Length = 132).

Test #10:

score: 0
Accepted
time: 0ms
memory: 3708kb

input:

5 3
011
111
110
111
011
3 1 2 1

output:

UULDDDLUDRUUUULDURDRDDUUDLDRUULUDDDDULUURDLDUUDDRDRUDLUUUURDULDDDLUU

result:

ok Valid Solution (Length = 68).

Test #11:

score: 0
Accepted
time: 1ms
memory: 3760kb

input:

4 5
11111
11111
11111
11111
3 2 1 3

output:

UUURDDDRUUUDDDLUUULLDDDLUUUDDDRUUURDDDDDDRUUURDDDUUULDDDLLUUULDDDUUURDDDRUUU

result:

ok Valid Solution (Length = 76).

Test #12:

score: 0
Accepted
time: 1ms
memory: 3708kb

input:

5 5
11111
10101
11111
10101
11111
2 5 1 1

output:

UUUULLDDRLDDRLLLUURLUURLDDDDRRUUUURRDDDDUUUULLDDDDLLUUUUDDDDRRUUUURRDDDDLRUULRUULLLRDDLRDDLLUUUU

result:

ok Valid Solution (Length = 96).

Test #13:

score: 0
Accepted
time: 0ms
memory: 3724kb

input:

4 5
11111
10000
11111
00001
1 3 4 5

output:

DRRRRDDLLLLRRRRUULLLLUDRDRRRDDLLLUURRRUULLLLRRRRDDLLLLDDRRRRLLLLUURRRUULLLDDRRRDRDULLLLUURRRRLLLLDDRRRRD

result:

ok Valid Solution (Length = 104).

Test #14:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

3 5
10100
00010
00111
1 3 1 1

output:

-1

result:

ok No Solution.

Test #15:

score: 0
Accepted
time: 0ms
memory: 3736kb

input:

4 5
10001
11111
11100
11111
4 5 3 1

output:

ULDDRDULLLLDURRUULLRRDDRUURDDDLUUULDDUURDDDRUUDLUURDULDDULDLLDLUDDLUDRUULDUURDDDRUUDDLUUULDDDRUURDDRRLLUURRUDLLLLUDRDDLU

result:

ok Valid Solution (Length = 120).

Test #16:

score: 0
Accepted
time: 1ms
memory: 3640kb

input:

3 5
11111
10100
11111
1 2 3 5

output:

RRDDRRUULRDDLLLLRRUULLDDRRRRDDLLUURRLLLLDDRLUURRDDRR

result:

ok Valid Solution (Length = 52).

Test #17:

score: 0
Accepted
time: 1ms
memory: 3732kb

input:

4 5
01110
10101
11011
10111
1 3 2 3

output:

-1

result:

ok No Solution.

Test #18:

score: 0
Accepted
time: 1ms
memory: 3724kb

input:

5 5
11111
11111
11111
11111
11111
1 3 5 2

output:

DDDDRUUUUDDDDLLUUUULDDDDLUUUUDDDDRUUUURDDDDRUUUUDDDDLUUUULDDDDUUUURDDDDRUUUURDDDDUUUULDDDDLUUUULLDDDDUUUURDDDD

result:

ok Valid Solution (Length = 110).

Test #19:

score: 0
Accepted
time: 1ms
memory: 3724kb

input:

5 5
11111
10101
11111
10101
11111
5 1 2 3

output:

UUULLDDRLDDRRRRUULRUULRDDDDLLLLUUUURRDDDDRRUUUULLDDDDLLUUUURRDDDDRRUUUULLLLDDDDRLUURLUURRRRDDLRDDLLUUU

result:

ok Valid Solution (Length = 102).

Test #20:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

5 5
11111
10000
11111
00001
11111
4 5 5 3

output:

RRLLLLDDRRRRDDLLLLRRRRUULLLLUURRLLDDRRRRDDLLRRUULLLLUURRRRLLLLDDRRRRDDLLLLRR

result:

ok Valid Solution (Length = 76).

Test #21:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

5 5
01010
10101
10101
11001
10011
4 1 5 4

output:

-1

result:

ok No Solution.

Test #22:

score: 0
Accepted
time: 1ms
memory: 3772kb

input:

5 5
10101
11111
10101
11111
11111
3 1 2 4

output:

LDUUUURDRURDRDDLLDUUDRRDUUUUDLULDLULDDDRURDRUUDRUUUURDLUUUULDRDDDUUUULDLDDDRUUDDUURDDDLDLUUUUDDDRDLUUUULDRUUUURDUURDRURDDDLULDLULDUUUUDRRDUUDLLDDRDRURDRUUUUDL

result:

ok Valid Solution (Length = 158).

Test #23:

score: 0
Accepted
time: 1ms
memory: 3676kb

input:

5 5
00001
11111
01110
01111
01111
1 5 5 2

output:

DDDRLLUUULDLUDRDDLDURUUURDDDRUUUDDDUULDDUUURDDDUUULDDDUULDDLDLURRULDLDDLUUDDDLUUUDDDRUUUDDLUUDDDUUURDDDRUUURUDLDDRDULDLUUULLRDDD

result:

ok Valid Solution (Length = 128).

Test #24:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

5 5
01011
10111
11011
10101
01110
4 1 2 3

output:

-1

result:

ok No Solution.

Test #25:

score: 0
Accepted
time: 1ms
memory: 3944kb

input:

10 8
11111111
11111111
11111111
11111111
11111111
11111111
11111111
11111111
11111111
11111111
7 7 3 6

output:

UUUUUUULDDDDDDDDDRURUUUUUUUURDDDDDDDDDRUUUUUUUUURDDDDDDDDDRUUUUUUUUUDDDDDDDDDLUUUUUUUUULDDDDDDDDDLLRUUUUUUUUULDDDDDDDDLDLLUUUUUUUUUDDDDDDDDDRUUUUUUUUURDDDDDDDDDDDDDDRUUUUUUUUURDDDDDDDDDUUUUUUUUULLDLDDDDDDDDLUUUUUUUUURLLDDDDDDDDDLUUUUUUUUULDDDDDDDDDUUUUUUUUURDDDDDDDDDRUUUUUUUUURDDDDDDDDDRUUUUUUUURURD...

result:

ok Valid Solution (Length = 316).

Test #26:

score: 0
Accepted
time: 0ms
memory: 3744kb

input:

10 6
111111
101010
111111
101010
111111
101010
111111
101010
111111
101010
1 6 2 3

output:

UUUUUUULLLRDDRLLRDDRLLRDDRLLRDDRRRRUULRUULRUULRUULRUDDDDDDDDDLLLLLRUUUUUUUUUDRRUDDDDDDDDDRDDDDDDDDDRUUUUUUUUURDDDDDDDDLUDDLLUULLDDULDDDDDDDDRUUUUUUUUURDDDDDDDDDRDDDDDDDDDURRDUUUUUUUUURLLLLLDDDDDDDDDURLUURLUURLUURLUURRRRDDRLLRDDRLLRDDRLLRDDRLLLUUUUUUU

result:

ok Valid Solution (Length = 250).

Test #27:

score: 0
Accepted
time: 1ms
memory: 3868kb

input:

10 10
1111111111
1000000000
1111111111
0000000001
1111111111
1000000000
1111111111
0000000001
1111111111
1000000000
5 5 5 2

output:

RUULLLLLLLLLUURRRRRRRRRUDLLLLLLLLLDDRRRRRRRRRDDLLLLLLLLLDDRRRRRRRRRDDLLLLLLLLLRRRRRRRRRUULLLLLLLLLUURRRRRRRRLLLLLLLLDDURDRRRRRRRRUURLLLLLLLLLUURRRRRRRRRUULLLLLLLLLUURRRRRRRRRULDLLLLLLLLDDRRRRRRRRURDLDLLLLLLLLDDRRRRRRRRURDLDLLLLLLLLDLDRURRRRRRRRDDLLLLLLLLDLDRURRRRRRRRDDLLLLLLLLDLURRRRRRRRRUULLLLLLLLL...

result:

ok Valid Solution (Length = 454).

Test #28:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

10 10
1010110101
0000011010
1001001001
0011111000
1000111100
1011101001
1100110011
0110001011
0011111000
0101011101
7 5 4 3

output:

-1

result:

ok No Solution.

Test #29:

score: 0
Accepted
time: 1ms
memory: 3820kb

input:

10 6
100100
111111
100001
111111
101111
111111
101010
111111
111100
111111
6 5 7 3

output:

UUULLLRRDDLLRDDDDLDDRRRRRDUUUUULLDDRLLUUDDRUURRUUUULDDUURDDDDDDDDLLLDULLUUUUDDRUUUURUURDDDDDDUUUDRDDDRDDDDDLUUUUUDDDDLDDRDRUUUUUUUUULDDLDDDDUUUDRDRDDDLDDUUUDLDDUUUUUUUDDDDLDDRDUUUUUUUDDDDDRDLUUUUUURDDDUURDDRUUUUUDDDDLDDLDDLDULDLUUUURDDRUULDDRUDRRDDDLUDRDLUUUUUULDRDULDDDRRDURDDLUURDDRUUUULDLUDLDDLDDL...

result:

ok Valid Solution (Length = 516).

Test #30:

score: 0
Accepted
time: 1ms
memory: 3836kb

input:

10 8
11111110
11110111
01111111
11111101
11011101
11111111
11111011
11011101
11001111
11111110
7 1 2 1

output:

DLUUUUUUUUURDDDDDDUUUUUULLLLDDDDDDDLUUULULDDDDDRDRRRUUURDDDUUULUUURDULUDDDDDDDLLUDLUUDLUUUUUUURURDDUULDLDDRDRDDDRUUUUUUURRRDDDDDDDDDRUDLUUUDDLDUUURDDDLUUURDDUUUUUUUUDDDDDDRUUDLUUUUURDDDDDDUUUUUUDDDDLULDLDDDDDUUUUUUULDDDDDUUUUDDRDDRDDUUUUDDDDDLUUUUUUUDDDDDLDLULDDDDUUUUUUDDDDDDRUUUUULDUURDDDDDDUUUUUUU...

result:

ok Valid Solution (Length = 458).

Test #31:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

10 10
1111011101
1110111110
1111011111
1011101111
0101010111
1110111111
0111010111
1011111011
0111010101
1011111110
2 6 7 4

output:

-1

result:

ok No Solution.

Test #32:

score: 0
Accepted
time: 0ms
memory: 4076kb

input:

8 10
1111111111
1111111111
1111111111
1111111111
1111111111
1111111111
1111111111
1111111111
8 10 6 10

output:

UURDDDDDDDRUUUUUUURDDDDDDDRUUUUUUURDDDDDDDRUUUUUUURDDDDDDDRUUUUUUURDDDDDDDUUUUUUULDDDDDDDLUUUUUUULDDDDDDDLUUUUUUULDDDDDDDLUUUUUUULDDDDDDDLLUUUUDDDDRUUUUUUULDDDDLUUUUUUURDDDDUUUULLDDDDDDDLUUUUUUULDDDDDDDLUUUUUUULDDDDDDDLUUUUUUULDDDDDDDLUUUUUUUDDDDDDDRUUUUUUURDDDDDDDRUUUUUUURDDDDDDDRUUUUUUURDDDDDDDRUU...

result:

ok Valid Solution (Length = 316).

Test #33:

score: 0
Accepted
time: 0ms
memory: 4040kb

input:

10 10
1111111111
1010101010
1111111111
1010101010
1111111111
1010101010
1111111111
1010101010
1111111111
1010101010
3 5 9 1

output:

DDDDDDDDLLUURLUURLUURLUURLLLDDRLDDRLDDRLDDRLLLUURLUURLUURLUURLLLLRDDRLLRDDRLLRDDRLLRDDRLLRUUUUUUUUUDRRUDDDDDDDDDRRUUUUUUUUUDRRUDDDDDDDDDRRUUUUUUUUUDDDDDDDDDLUUUUUUUUURUUUUUUUUURDDDDDDDDDLUUUUUUUUURUUUUUUUUURDDDDDDDDDLUUUUUUUUURUUUUUUUULDDDDDDDDDRDDDDDDDUUUUUUULLDDDDDDDDUUUUUUUUURDDDDDDDDDLDDDDDDDDDL...

result:

ok Valid Solution (Length = 1544).

Test #34:

score: 0
Accepted
time: 1ms
memory: 3860kb

input:

10 10
1111111111
1000000000
1111111111
0000000001
1111111111
1000000000
1111111111
0000000001
1111111111
1000000000
5 4 7 2

output:

RDDLLLLLLLLLDDRRRRRRRRRDDLLLLLLLLLRRRRRRRRRUULLLLLLLLLUURRRRRRRRRUULLLLLLLLLUURRRRRRRRRUDLLLLLLLLLDDRRRRRRRRRDDLLLLLLLLLDDRRRRRRRRRDDLLLLLLLLLDRURRRRRRRRUULLLLLLLLDLURDRRRRRRRRUULLLLLLLLUURRRRRRRRDRULDLLLLLLLLUURRRRRRRRUULLLLLLLLDLURDRRRRRRRRUULLLLLLLLUURRRRRRRRDRULDLLLLLLLLUURRRRRRRRURDLLLLLLLLLDDR...

result:

ok Valid Solution (Length = 430).

Test #35:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

9 10
1111001000
1110010111
0001001000
0101000101
1101000001
0111100110
0010010000
0001001000
1011001101
2 8 5 2

output:

-1

result:

ok No Solution.

Test #36:

score: 0
Accepted
time: 1ms
memory: 3728kb

input:

5 10
1001011101
1111111111
1000011001
1111111111
1101110010
4 3 4 7

output:

DDDRUUUURDRRRURDDDLLLLRDURRRDUUUULDLLUDLULDDDDLLULLDUUURRLUDLDDRRDRUUUDDDUURDDURDRDURUUURDRDRUUDLLULDRULDDDRDRURUUURDDDRDUUUUDLURDDLDLULLDULUULDLUUURDDRUUULDLUULUDLLULDLDDRULDUUUUDRDDDRUUURURDRDDDLURDLULLDUURDRDRUUURUDRDRUDDRUUDDDUUURDRRDDLDULRRUUUDLLULLDDDDLULDULLDLUUUUDRRRUDRLLLLDDDRURRRDRUUUURDDD

result:

ok Valid Solution (Length = 300).

Test #37:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

7 10
1111111001
1111101110
1111011111
1101011101
1111011111
1111001011
1111111011
7 10 7 2

output:

-1

result:

ok No Solution.

Test #38:

score: 0
Accepted
time: 1ms
memory: 4124kb

input:

9 10
0101011101
1111111111
0101111111
1111111111
1111110101
1011111111
1101111101
1111111011
1101011111
3 7 7 10

output:

UURRRDDDLDDDDLUULDDDUUUUURLDDRDDRDRUUURUUUURDDDDDDRDUUUUUUURRURDDLRDDDLDDRLLRDUUUULDUUDRDRUUUUULDLLUDDDDDDDLLDUUDRUUUUUULUDDDDDLDDDLUUUUUUDRUUULLDULDDDDDDDDRUUUUDDDRUURDDDUUUUUDRDDDDUUUUUURDRDDDDDLUUDRUUUUUUULDDDUURDRDDDDDRDLUUDRUUUUUUUURDLUDRUUUDDDLUUUDDRDDDDDLDUUUDRDDUUUURDLDDDRUUUURDLDLDDLUDRUUUU...

result:

ok Valid Solution (Length = 1612).

Test #39:

score: 0
Accepted
time: 1ms
memory: 4108kb

input:

10 10
1111111111
1111111111
1111111111
1111111111
1111111111
1111111111
1111111111
1111111111
1111111111
1111111111
9 5 3 2

output:

UUUUUUULDDDDDDDDDRURDUUUUUUUUUDDDDDDDDLDLLUUUUUUUUULDDDDDDDDDLUUUUUUUUULDDDDDDDDDLUUUUUUUUULDDDDDDDDDLUUUUUUUUUDDDDDDDDDRUUUUUUUUURDDDDDDDDDRUUUUUUUUURDDDDDDDDDRUUUUUUUUURDDDDDDDDDRUUUUUUUUURDDDDDDDDDDDDDDRUUUUUUUUURDDDDDDDDDRUUUUUUUUURDDDDDDDDDRUUUUUUUUURDDDDDDDDDRUUUUUUUUURDDDDDDDDDUUUUUUUUULDDDDD...

result:

ok Valid Solution (Length = 396).

Test #40:

score: 0
Accepted
time: 1ms
memory: 4060kb

input:

10 10
1111111111
1010101010
1111111111
1010101010
1111111111
1010101010
1111111111
1010101010
1111111111
1010101010
2 1 1 3

output:

UUUUUUUURRDDLRDDLRDDLRDDLRUUUUUUUUUDLLLLDDRLDDRLDDRLDDRLLLUURLUURLUURLUURLLLLRDDRLLRDDRLLRDDRLLRDDRLLRUUUUUUUUUDRRUDDDDDDDDDRRUUUUUUUUUDRRUDDDDDDDDDUUUUUUUUURDDDDDDDDDRDDDDDDDDDRUUUUUUUUURDDDDDDDDRDLDDDDDDDDRUUUUUUUUURDDDDDDDDDLLUUUUUUUUURDDDDDDDDDLUUUUUUUUURUUUUUUUUURDDDDDDDDDRUUUUUUUUURUUUUUUUUULD...

result:

ok Valid Solution (Length = 1480).

Test #41:

score: 0
Accepted
time: 0ms
memory: 3764kb

input:

10 10
1111111111
1000000000
1111111111
0000000001
1111111111
1000000000
1111111111
0000000001
1111111111
1000000000
7 4 3 5

output:

RRRRDDLLLLLLLLLRRRRRRRRRUULLLLLLLLLUURRRRRRRRRUULLLLLLLLLUURRRRRRRRRUDLLLLLLLLLDDRRRRRRRRRDDLLLLLLLLLDDRRRRRRRRRDDLLLLLLLLLDRURRRRRRRRUULLLLLLLLDLURDRRRRRRRRUULLLLLLLLUURRRRRRRRDRULDLLLLLLLLUURRRRRRRRUULLLLLLLLDLURDRRRRRRRRUULLLLLLLLUURRRRRRRRDRULDLLLLLLLLUURRRRRRRRURDLLLLLLLLLDDRRRRRRRRRDDLLLLLLLLL...

result:

ok Valid Solution (Length = 392).

Test #42:

score: 0
Accepted
time: 1ms
memory: 3648kb

input:

10 10
1110000101
1100110001
1011011001
0000000111
0010010111
0100111011
1110010011
1100111111
0110001110
0100000101
9 9 6 10

output:

-1

result:

ok No Solution.

Test #43:

score: 0
Accepted
time: 1ms
memory: 3940kb

input:

10 10
1110111011
1111111111
1110110000
1111111111
1010011100
1111111111
1111001110
1111111111
1001010011
1111111111
6 9 2 9

output:

RRDRUUUUULUULDDLLRUUUURRRDDRRUURRRDDDDDDDDDLUUULDDLLDUUURLDDRRDUUUUUULDLRURURDDUULDDDDRDDDRUUUUUUUUULLLLRDDLLUULLLLDDUURDDDDRDDRUDLLLRRUUUURDDRDDDDDLULLDLUDRURDDDDDRDRUUUUDDDDRUUURUURDDDUUUUUDDDRDDUUURDDDLUUULDDDUUUUUUDDDDRDDRUUUUUDDDDLUULUUUURDDUURDDDDDDDUUUUUULDLDDDDDUUUUDDRDDRUUDDLUUURDDDLUUURDDU...

result:

ok Valid Solution (Length = 1234).

Test #44:

score: 0
Accepted
time: 1ms
memory: 4104kb

input:

10 10
1111110011
1011111110
0111011111
1101101101
1111111110
1110111101
1011011111
1111111101
1011111101
1111111011
7 3 5 5

output:

ULUUUULDDDDDRLDDDRDRURUULRURUUUUURRDDLRDDDDLDLDDRRUDLLLRUURUUUDDRUUUUUULLLDDLUUDDRDUUURDDDDDLDDDLDLUUDLLULLUDRDDLRUURUULRUULLDUUUURLDDDRRUUDDDDDDDRUUUUUUUURDDDDRDDUULDLDDDUUUUUUDDDDLDDUUUUUUDDDRDDDUUUUUDDDLUUUUURDDDDDDDUUUUUDDDLDDUUUUUDDLUURDDDRUDRDRURDRUURUUUDDDLDDRDDRULDLDRULDLUURURDLUUURURDLDDDDD...

result:

ok Valid Solution (Length = 1564).

Test #45:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

10 10
1101011101
1110111011
0101110101
1111101011
1111111111
1010111010
0111111101
1111101011
0111111101
1011101111
3 8 2 2

output:

-1

result:

ok No Solution.

Test #46:

score: 0
Accepted
time: 1ms
memory: 4660kb

input:

20 12
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
16 8 13 12

output:

UUUUUUURDDDDDDDDDDDDDDDDDDDRUUUUUUUUUUUUUUUUUUURDDDDDDDDDDDDDDDDDDDRUUUUUUUUUUUUUUUUUUURDDDDDDDDDDDDDDDDDDDRUUUUUUUUUUUUUUUUUUURDDDDDDDDDDDDDDDDDDDRUUUUUUUUUUUUUUUUUUURDDDDDDDDDDDDDDDDDDDRUUUUUUUUUUUUUUUUUUURDDDDDDDDDDDDDDDDDDDUUUUUUUUUUUUUUUUUUULDDDDDDDDDDDDDDDDDDDLUUUUUUUUUUUUUUUUUUULDDDDDDDDDDDDD...

result:

ok Valid Solution (Length = 956).

Test #47:

score: 0
Accepted
time: 1ms
memory: 5160kb

input:

20 17
11111111111111111
10101010101010101
11111111111111111
10101010101010101
11111111111111111
10101010101010101
11111111111111111
10101010101010101
11111111111111111
10101010101010101
11111111111111111
10101010101010101
11111111111111111
10101010101010101
11111111111111111
10101010101010101
111111...

output:

UUUUUUUUUUUUULLDDRLDDRLDDRLDDRLDDRLDDRLDDDDDDRRUULRUULRDDDDLLLLUURLUURLUURLUURLUURLUURLUURLUURLUURLLLDDRLDDRLDDRLDDRLDDRLDDRLDDRLDDRLDDRLLLUURLUURLUURLUURLUURLUURLUURLUURLUURLLLDDRLDDRLDDRLDDRLDDRLDDRLDDRLDDRLDDRLLLUURLUURLUURLUURLUURLUURLUURLUURLUURLLLDDRLDDRLDDRLDDRLDDRLDDRLDDRLDDRLDDRLLLUURLUURLU...

result:

ok Valid Solution (Length = 5298).

Test #48:

score: 0
Accepted
time: 1ms
memory: 3768kb

input:

20 19
1111111111111111111
1000000000000000000
1111111111111111111
0000000000000000001
1111111111111111111
1000000000000000000
1111111111111111111
0000000000000000001
1111111111111111111
1000000000000000000
1111111111111111111
0000000000000000001
1111111111111111111
1000000000000000000
11111111111111...

output:

RRRRRRRRRRRDDLLLLLLLLLLLLLLLLLLDDRRRRRRRRRRRRRRRRRRDDLLLLLLLLLLLLLLLLLLDDRRRRRRRRRRRRRRRRRRDDLLLLLLLLLLLLLLLLLLRRRRRRRRRRRRRRRRRRUULLLLLLLLLLLLLLLLLLUURRRRRRRRRRRRRRRRRRUULLLLLLLLLLLLLLLLLLUURRRRRRRRRRRRRRRRRRUULLLLLLLLLLLLLLLLLLUURRRRRRRRRRRRRRRRRRUULLLLLLLLLLLLLLLLLLUURRRRRRRRRRRRRRRRRRUULLLLLLLLL...

result:

ok Valid Solution (Length = 840).

Test #49:

score: 0
Accepted
time: 0ms
memory: 3724kb

input:

20 16
0101001111110001
0000111101001011
0000111100011001
1101110100110100
1011011110001101
1101000110111111
0111010111100101
1101101111011001
1101010100000101
1111001000110010
0001011000101000
0101111010110110
0001101111000111
1010100010000110
0100100011011100
0100100101011111
0001000001001110
10011...

output:

-1

result:

ok No Solution.

Test #50:

score: 0
Accepted
time: 2ms
memory: 5896kb

input:

20 18
100101011111011110
111111111111111111
101111101010000001
111111111111111111
110010011011001010
111111111111111111
110110111110000010
111111111111111111
100001000001111000
111111111111111111
100010100111111000
111111111111111111
111100011010110111
111111111111111111
111101010111011110
111111111...

output:

LUULLLRUURRUULLLRRRUULUUUUUURUURRRDDRRUURRDDLRDDDDDDLUULUURLLDDDDDDLUULUULDDDDDDRURDRDDDDLLRUULLRRDDRDDDRURUULRUUUURDDDDRDDRDUUURUUUULLDDRLUURUULLLLUUDDRRRUURRDDRRRRDDDDDDDDLLUURUUUULLDDRLUURRDDDDLLDDLUDRDUUURDDRRDUUUUUUUUUUUUUUUUUUULDDLUULDDDDDDLLLRUURLLRUURLLUURRLLDDRDDDDRRDDRUUUURDDDDUUUULUDDDDDL...

result:

ok Valid Solution (Length = 13916).

Test #51:

score: 0
Accepted
time: 2ms
memory: 5660kb

input:

20 16
1110111111111111
1111111001111111
1111110111111011
1111110011111111
1111111111011111
1111110111101111
1111011111111111
1101111111111111
1011111111111001
0111111011111111
1110111111111111
1111111111111111
1111011011111111
0101110111111111
1110111101111110
1111111111111111
1111111111011111
11111...

output:

UUUUUUUUUULDDDDDLUUUUULDDDDLUUUULDDLDDDDDDDDDDDLUUUUUUUUUUULUURRLLLDDDDLUUUDDDRDDDDDDRUUUUUUUDDDDDDDLLDDDDDDDDDRUUUUUUURDDDDRURDDDDRUUURUUUUUUUUUURRLDDDDDDDDDDDRLLDDRRRURUUUUUUURUUURUULUUUUUURDDDDRUUUURDDDDDRUUUUUDDDDDLLRDDDDRUUDDLDLDLDLRDDDDDDRUUUUURURDDDDDDDLLRUUUUUDDDDDRUUUUUUUUDLDLDDDDDLLDLRUUUU...

result:

ok Valid Solution (Length = 11024).

Test #52:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

20 18
110111110101110101
101010111110101010
110101111101111101
111011111011101111
010111110111111101
111011111011111011
011111110111010111
101110101010111010
010111110101110111
101010101011101110
011101110111011111
101010111011111010
010101111111110101
101011101110111011
110101011101010101
101010101...

output:

-1

result:

ok No Solution.

Test #53:

score: -100
Wrong Answer
time: 1ms
memory: 3604kb

input:

14 20
11111111111111111111
11111111111111111111
11111111111111111111
11111111111111111111
11111111111111111111
11111111111111111111
11111111111111111111
11111111111111111111
11111111111111111111
11111111111111111111
11111111111111111111
11111111111111111111
11111111111111111111
11111111111111111111
...

output:

14 2 14 13

result:

wrong answer Line [name=User Output] equals to "14 2 14 13", doesn't correspond to pattern "-1|[LRUD]{0,1000000}"