QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#294159#8981. Kangaroo Puzzlegeorgeyucjr#AC ✓6ms5148kbC++233.0kb2023-12-30 08:46:492024-11-05 18:07:59

Judging History

你现在查看的是最新测评结果

  • [2024-11-05 18:07:59]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:AC
  • 用时:6ms
  • 内存:5148kb
  • [2024-11-05 18:07:55]
  • hack成功,自动添加数据
  • (/hack/1130)
  • [2023-12-30 08:46:49]
  • 评测
  • 测评结果:100
  • 用时:4ms
  • 内存:4808kb
  • [2023-12-30 08:46:49]
  • 提交

answer

# include <bits/stdc++.h>
using namespace std;
# define ll long long
# define ull unsigned long long
# define rep(i, f, t, ...) for (int i = f, ##__VA_ARGS__; i <= t; ++i)
# define red(i, f, t, ...) for (int i = f, ##__VA_ARGS__; i >= t; --i)
# define emb emplace_back
# define pb push_back
# define pii pair<int, int>
# define mkp make_pair
# define arr3 array<int, 3>
# define arr4 array<int, 4>
# define FILEIO(filename) freopen (filename".in", "r", stdin), freopen (filename ".out", "w", stdout)
# define ALL(vc) vc.begin ( ), vc.end ( )
# define N 25
# define M 405
template < class T > constexpr static T inf = numeric_limits < T > :: max ( ) / 2;

# ifndef __GEORGEYUCJR_READ__
# ifdef MACOS
# include "/Users/yzw/GeorgeYuOI/codes/cpp/georgeyucjr/debug/debug.hpp"
using namespace georgeyucjr;
# else
# define write(...) void(36)
# define bug(...) void(36)
# endif
# else
# warning Do not use debug.hpp.
# endif

bool Mst;

int n, m, cnt;
int vs[N][N], gr[M][4], dist[M][M], pre[M][M];
constexpr int _dx[4] = { -1, 0, 1, 0};
constexpr int _dy[4] = {0, 1, 0, -1};
constexpr char DRUL[5] = "URDL";

bool Med;

signed main() {
	ios_base :: sync_with_stdio ( false ), cin.tie ( nullptr ), cout.tie (nullptr);

	cin >> n >> m;
	vector < string > mp;
	mp.resize(n);
	for (auto&i : mp) cin >> i;
	cnt = 0;
	memset(vs, -1, sizeof vs);
	rep (i, 0, n - 1) rep (j, 0, m - 1) if (mp[i][j] == '1') vs[i][j] = cnt++;
	rep (x, 0, n - 1) rep (y, 0, m - 1, u)
	if (~(u = vs[x][y]))
		rep (d, 0, 3, dx, dy)
		gr[u][d] = (0 <= (dx = x + _dx[d]) && dx < n && 0 <= (dy = y + _dy[d]) && dy < m
		              && ~vs[dx][dy]) ? vs[dx][dy] : u;
	queue<pair<int, int>> que;
	queue < pii > q;
	memset(dist, -1, sizeof dist);
	memset(pre, -1, sizeof pre);
	rep (u, 0, cnt - 1) dist[u][u] = 0, q.emplace(u, u);
	while (!q.empty()) {
		auto [u, v] = q.front();
		q.pop();
		rep (d, 0, 3)
		for (auto uu : {u, gr[u][d ^ 2]}) if (gr[uu][d] == u)
			for (auto vv : {v, gr[v][d ^ 2]}) if (gr[vv][d] == v)
			if (!~dist[uu][vv]) {
				dist[uu][vv] = dist[u][v] + 1;
				pre[uu][vv] = d;
				q.emplace(uu, vv);
			}
	}
	rep (u, 0, cnt - 1) rep (v, 0, cnt - 1) assert ( ~ dist[u][v] );
	vector < int > vc(cnt); iota(ALL(vc), 0);
	string ans;
	while (vc.size() > 1) {
		int mn = cnt * cnt, posu = -1, posv = -1;
		rep (i, 0, SZ - 1, SZ = vc.size()) rep (j, i + 1, SZ - 1)
		if (mn > dist[vc[i]][vc[j]])
			mn = dist[vc[i]][vc[j]],
			posu = vc[i],
			posv = vc[j];
		for (int u = posu, v = posv, d = 0; u != v; )
			ans += DRUL[d = pre[u][v]], u = gr[u][d], v = gr[v][d], for_each(ALL(vc), [&](auto & x) {x = gr[x][d];});
		sort(ALL(vc)),
		     vc.erase(unique(ALL(vc)), vc.end());
	}
	cout << ans << endl;

# ifdef nACOS
	cerr << "nemory & Time Information : " << endl;
	cerr << "nemory : " << ( ( &ned ) - ( &nst ) ) * 1. / 1024. / 1024. << "nB" << endl;
	cerr << "Time : " << clock ( ) * 1. / CLOCKS_PER_SEC * 1000. << "ms" << endl;
# endif
	return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4 4
1111
1001
1001
1110

output:

LLLUUULLL

result:

ok AC

Test #2:

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

input:

2 15
111111111111111
101010101010101

output:

LLLLLLLLLLLLLLULLLLLLLLLLLLLL

result:

ok AC

Test #3:

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

input:

1 2
11

output:

L

result:

ok AC

Test #4:

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

input:

20 20
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000010000
00000000000000010100
00000000000000111110
11001100000001101001
01110100111001000111
10011111101111001101
11110100110101001001
01000000001101011101
00000000000011010000
01000000000110010000
11100000001010110000
...

output:

UULUULULLDLULLLLULULLULLRUULRUULULLLULLRUUULRULDDDRRDRRUUDRRUUDDRRRDLDDLDDDDDLDLLULLDLDRRDDLLLURRRURRDLLLRRRDDDLDDDDLLDLDDDLLL

result:

ok AC

Test #5:

score: 0
Accepted
time: 4ms
memory: 4864kb

input:

20 20
10101010000000111100
11111110000000100111
00101000000000000101
11101100000000001011
01000101100000001101
01001110111010111011
00111011001011101010
00101001111001001111
11001011000111011010
01010110000000110100
11110010000101011100
10011111101101110011
10101000100111000110
11100111111100111011
...

output:

UUULULLLUUULLLUUUUULLDLLULULLULDLLLLDLLULDLLRRDDLUUUUDDRDDULLLURULLUUURUUURULULLDRRURUULUUULLUUUUURUURDLDDDDDRRUULLLLLUUDDRRRUUURURRRUUDDDRDDRDRDLLLRURRUURUUUUDLDDRRURURRRRRUUULDRDDLLLLDLULULULLLUULLUUURDDLDDLLDRRDLDRRRDDLLDLUUL

result:

ok AC

Test #6:

score: 0
Accepted
time: 6ms
memory: 4828kb

input:

20 20
11101111101011101010
10110000101100111111
11011111100101001010
10010010110111110111
01101001101101010101
11001111010101011001
01110101110010001111
11010100001110011001
01010111101011100111
10111100100100111101
11001011111101010100
10111010010011010011
10100110111110111110
11101011010101101000
...

output:

LLUUULLUUULLUUULLULLDLLLLULLLULULUUDLDLDLRDLLDDDLLLDDRUURRUDDLUUULLLURUULLLLULLULLURUULUUDRRURRUUUDRDLLLLLRRDRDDDRURRUUULUUURDDDDDDRRRDDDDDLDLDLLUUUDRDRRDDDRRLULURRDLDDRRUUUUDDLLUURUULDDLUULUDRDRDDDDLLUULLUUUUULLURRULURULLL

result:

ok AC

Test #7:

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

input:

10 10
1010100000
1111110000
0001010000
0101000000
1111100000
1001000000
1110000000
1011000000
0001100000
0000110000

output:

UUUURULURUULURDLLLLULURLLUURDRRUUULU

result:

ok AC

Test #8:

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

input:

12 12
000000011101
000011110111
000001010001
000011000011
000010000000
000010000000
000000000000
000000000000
000000000000
000000000000
000000000000
000000000000

output:

LLLUULLRUUURDLLURRRULL

result:

ok AC

Test #9:

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

input:

20 20
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000100000000000
00000011110000000000
00000001010000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
...

output:

ULURRU

result:

ok AC

Test #10:

score: 0
Accepted
time: 3ms
memory: 4920kb

input:

20 20
00000000000111111111
00000000000010010100
10000000000001110111
10000000110010010100
11000011010011010001
01000010010101011111
01110111110111110000
11011101011100100011
01000000110000111110
11000000000000101010
01110100100001101101
11011111111000010111
10000010101001111010
11000011000111010010
...

output:

LLLLLLLLULUULUULLUULLLUDDLLDLLLLRUUUUULLLRRUURRUUUURRRRUUUDLLLLLDRRLDLLDLUURULLUUUUUUDDLUDRRDLLRRURRDDLDRRLLDLLLLDLLURRDRRURRRDDRRURUUULURLUU

result:

ok AC

Test #11:

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

input:

2 1
1
1

output:

U

result:

ok AC

Test #12:

score: 0
Accepted
time: 3ms
memory: 4912kb

input:

20 20
11111111111111111111
10000000000000000000
11111111111111111111
00000000000000000001
11111111111111111111
10000000000000000000
11111111111111111111
00000000000000000001
11111111111111111111
10000000000000000000
11111111111111111111
00000000000000000001
11111111111111111111
10000000000000000000
...

output:

LLLLLLLLLLLLLLLLLLLUUULLLLLLLLLLLLLLLLLLLUUDLLDDULLDLLULLDLLULLDLLULLDLLRRRLLUUURRRRRRRRRRRRRRRRRRRUUDDDLUUULLLLLLLLLLLLLLLLLLLUUDDRRRRRRRRRRRRRRRRRRRDDDLUUULLLLLLLLLLLLLLLLLLLUUDDRRRRRRRRRRRRRRRRRRRDDDLUUULLLLLLLLLLLLLLLLLLLUU

result:

ok AC

Test #13:

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

input:

20 20
11111011111011111011
00101100101100101101
10110110110110110111
10011011011011011001
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011001
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
...

output:

LLLLDDDDLLLRDLRURUUUDRURUUDRURUUDRURUUDRURUUDRURUUDRURUUDRURUUDRURUUDRURUUDRURUURUUDRDLLLRDLRDLRRRUUDRDLLLLULULULLRDDRDRDRDRDRUUULLLULULULULULULULULULLUULUURRDRDRDRDRDRDRDRDLLRDRDRDRRDDRRRLULLULULULULULULULULULULULULULULULDLRRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRRRULULLULULULULULULULULULULULULULULULUU

result:

ok AC

Test #14:

score: 0
Accepted
time: 4ms
memory: 5092kb

input:

20 20
11101110111110111110
10011011001011001011
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011001
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011001
...

output:

LLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUUDLULULLDDULDLULDLDDRDRUURRDRDRDRDRDRDRRUULULULUURRDRDRDRDRDLLRDRDRDRDRDDLLULULULULULULULULULULULLULULUURRDRDRDRDRDRDRDRDRDRDRDRDRRUULULULULULULULULULUUDRDRDRDRDRDRDRDRDRDRDDRRRLUULULULULULULULULULULULULULULUUUDRRDRDRDRDRDR...

result:

ok AC

Test #15:

score: 0
Accepted
time: 3ms
memory: 4848kb

input:

20 20
11111111111111111111
10000000000000000000
11111111111111111111
00000000000000000001
11111111111111111111
10000000000000000000
11111111111111111111
00000000000000000001
11111111111111111111
10000000000000000000
11111111111111111111
00000000000000000001
11111111111111111111
10000000000000000000
...

output:

LLLLLLLLLLLLLLLLLLLUURRRRRRRRRRRRRRRRRRRUULLLLLLLLLLLLLLLLLLLUUDDRDRULUURRRRRRRRRRRRRRRRRRRUUDDLLLLLLLLLLLLLLLLLLLDDRDRULUURRRRRRRRRRRRRRRRRRRUUDDLLLLLLLLLLLLLLLLLLLDDRDRULUURRRRRRRRRRRRRRRRRRRUUDDLLLLLLLLLLLLLLLLLLLDDRDRULUURRRRRRRRRRRRRRRRRRRUU

result:

ok AC

Test #16:

score: 0
Accepted
time: 4ms
memory: 4856kb

input:

20 20
00111100111100111101
11101011101011100001
10100110100110100111
01101101101101101101
11011011011011011011
10110110110110110110
11101101101101101101
10011011011011011001
10110110110110110111
01101101101101101101
11011011011011011011
10110110110110110110
11101101101101101101
10011011011011011001
...

output:

LLLUUUULLRULUUURULUUURULUUURULUUURULUUURULUUURULUUURULUUURULUUURULUUURULUUURULUUURULUUURULUUURULDLLURULRRUUDLURURUUUURURURURURURUUUURURURURURURUUUULLLDLLDLURRDLDLDLDLDLLDLDLDLDLDDRRURURURURULLRURURURRDLDLDLDLDLDLDLDLDLDLDLDLDLDLDDRRURURURURURURURURURURULLRURURURRDDLDLDLDLDLDLDLDLDLDLDLDLDLDLLDDRURUR...

result:

ok AC

Test #17:

score: 0
Accepted
time: 3ms
memory: 4844kb

input:

20 20
01000111000111000111
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
00110110110110110111
01011011011011011010
11101101101101101100
10110110110110110110
11011011011011011011
01101101101101101101
00110110110110110111
01011011011011011010
11101101101101101100
...

output:

ULULULULULULULULULULULULULUURULUURULUURULULURUDLDDRDRDRUUDDLLULULULUULULLDDRDRDRDRUULULULUURDRDRDRDRDRDRDRDRUUDDLLULULULULULULULULULUULULLDLURRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDLLRDRULULULULULULULULULULULULULULULULURULLDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRUU

result:

ok AC

Test #18:

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

input:

20 20
10111110111110111101
11101001101001101001
10011011011011011001
10110110110110110111
01101101101101101101
11011011011011011011
10110110110110110110
11101101101101101101
10011011011011011001
10110110110110110111
01101101101101101101
11011011011011011011
10110110110110110110
11101101101101101101
...

output:

UUULULLLUDLLUUDLUDRLUDRLUDRLUDRLUDRLUDRLUDRLUDRLUDRLUDRLUDRLUDRLUDRLUDRRDLLLLRURDDURDRDDLDLDLDLUUUDLDLDLDDLLRRRRURURURULLDLDLDLDLDLDLDLDLDLDDLLUURURURURURURURURURURURURURURURURUULLDLDLDLDLDLDLDLDLDLDLDLDLDLLUURURURURURURURURURURURURURUULLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLLUURURURURURURURURURURURURURUR...

result:

ok AC

Test #19:

score: 0
Accepted
time: 4ms
memory: 4856kb

input:

20 20
10111110111110111110
10001011001011001011
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011001
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011001
...

output:

UUUULLLLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUULLUULLUUDDDDRDRUURRDRDRDRDRDRDRRUULULULUULULUURRDRDRDRDRDRRUUDRDRDRDRDRDRRUULULULULULULULULULUULULUURRDRDRDRDRDRDRDRDRDRDRDRRUUDDRLUULULULULULULULULULULULULULULUUUDRRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDDLL

result:

ok AC

Test #20:

score: 0
Accepted
time: 4ms
memory: 4944kb

input:

20 20
10011111011111011111
11100101100101100101
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011001
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011001
11101101101101101101
...

output:

UUULULUUULULUUULULUUULULUUULULUUULULUUULULUUULULUURLLULUUDLLLLDDDRDRUUURRDRULLDRDRDRDRDLLRDRDRDDLLULULULULULULULRDRDRDRDRDRDRDRDRDRDRRUULULULULULULULULUULULULULUURDRDRDRDRDRDRDRDRDRDRDRDRDRDRUULULULULULULULULULULULULULULULUURDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDLL

result:

ok AC

Test #21:

score: 0
Accepted
time: 4ms
memory: 5104kb

input:

20 20
11111011111011111011
00101100101100101101
10110110110110110111
10011011011011011001
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011001
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
...

output:

LLLLDDDDDLLLRDLRUURUUDRUDLLLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLDLLRDLRDLRDLRDRUURUUUDDLLULULULLULULULURRLURLULULULULULULLLLULULULUULLDDDDRUURDRDRDRDRDRUUDRDDLLULULULULULULURRLURDRDRDRDRDRDRDRDRDRDRDRDRDRDRRUULULULULULULULULULULULUUDDRDRDRDRDRDRDRDRDRDRDRDDRRLULULULULULULULULULULULULULULULLUDRDRDRDR...

result:

ok AC

Test #22:

score: 0
Accepted
time: 3ms
memory: 4948kb

input:

20 20
11111111111111111111
10000000000000000000
11111111111111111111
00000000000000000001
11111111111111111111
10000000000000000000
11111111111111111111
00000000000000000001
11111111111111111111
10000000000000000000
11111111111111111111
00000000000000000001
11111111111111111111
10000000000000000000
...

output:

LLLLLLLLLLLLLLLLLLLUUULLLDLLDDULLDLLULLDLLLLLLLLUUULLDLLDDULLDLLULLDLLRRRLLUUURRRRRRRRRRRRRRRRRRRUUDDLDLURUULLLLLLLLLLLLLLLLLLLUUDDRRRRRRRRRRRRRRRRRRRDDLDLURUULLLLLLLLLLLLLLLLLLLUUDDRRRRRRRRRRRRRRRRRRRDDLDLURUULLLLLLLLLLLLLLLLLLLUU

result:

ok AC

Test #23:

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

input:

20 20
00011100011100011100
00010110010110010110
00011011011011011011
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
00110110110110110111
00011011011011011000
11101101101101101100
10110110110110110110
11011011011011011011
01101101101101101101
00110110110110110111
...

output:

LLUULLUULLUULLUULLUULLUULLUULLUULLUULLUULLUULLUULLUULLUULLUULLUULLUUDDRDRDRDRDDLLULULULULULULULLRRDRDRDRDRRUULULULULULULULUUDDRDRDRDRDRDRDRDRDRDRDDLLULULULULULULULULULULULULULLDDRDRDRDRDRDRDRDRDRDRDRDRDRDDLLULULULULURRDRDRDRDRRULULULULULULULULULULLRRDRDRDRDRDRDRDRDRDRDRRUULULULULULULULULULULULULULUU...

result:

ok AC

Test #24:

score: 0
Accepted
time: 4ms
memory: 4848kb

input:

20 20
11111011111011111011
00101100101100101101
10110110110110110111
10011011011011011001
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011001
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
...

output:

LLLLDDDDLLRDLRUURUUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLDLLRDLRDLRDLRDLDLLRRUUDDLLULULULLULULULURRLURLULULULULULULLLLDDDDRDRDRDRDRDRDDLLULULULLRDRDRDRDRDDLLULULULULULULURRLURLLDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRUULULULULULULULULULULULULULULULULLUUDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDDLLULULULULULULU...

result:

ok AC

Test #25:

score: 0
Accepted
time: 4ms
memory: 5108kb

input:

20 20
01101111011111011111
11011010010010010010
10110110110110110110
11101101101101101101
10011011011011011001
10110110110110110111
01101101101101101101
11011011011011011011
10110110110110110110
11101101101101101101
10011011011011011001
00110110110110110111
11101101101101101101
10011011011011011011
...

output:

LLLLUUUULLLRULULLLRULULLLRULULLLRULULLLRULULLLRULULLLRULUUULLLRULUUULLLRULUUULLLRULUUULLLRULUUULLLRULULLLRULULLLRURDRUUURURURRUULLLDLDLDLLDLDLLUURURURURDDURDURURURURURURURULURURUUUURURURURULULLLDDURRDLDLDLDLDLDLDLDLDLDLLUURURURURURURURURURURDDURDUURRRRLDDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLLLUURDRRURURUR...

result:

ok AC

Test #26:

score: 0
Accepted
time: 3ms
memory: 4792kb

input:

20 20
10101010101010101010
10111111111111111111
11000000000000000001
10111111111111111111
10100000000000000000
10111111111111111111
11000000000000000001
10111111111111111111
10100000000000000000
10111111111111111111
11000000000000000001
10111111111111111111
10100000000000000000
10111111111111111111
...

output:

UUUUUUUUUUUUUUUUUUULUULLLLLLLLLLLLLLLLLUUUUDLLLLLLLLLLLLLLLLRUULUUUUUUUUUUUUUURDRRRRRRRRRRRRRRRRRUULULDRDDLLLLLLLLLLLLLLLLLUURRRRRRRRRRRRRRRRRUULULDRDDLLLLLLLLLLLLLLLLLUURRRRRRRRRRRRRRRRRUULULDRDDLLLLLLLLLLLLLLLLLUUDDRRRRRRRRRRRRRRRRRDDLLLLLLLLLLLLLLLLLDDRRRRRRRRRRRRRRRRRDDLLLLLLLLLLLLLLLLLDDRRRRRRR...

result:

ok AC

Test #27:

score: 0
Accepted
time: 4ms
memory: 5072kb

input:

20 20
11011111011111011111
10110100110100110101
11101101101101101101
10011011011011011010
10110110110110110111
01101101101101101101
11011011011011011011
10110110110110110110
11101101101101101101
10011011011011011001
10110110110110110111
01101101101101101101
11011011011011011011
10110110110110110110
...

output:

LUUUULLLLUURULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDDRUULLUUURRUULRUULRUULLDLDLLDLDLDRRLDLDLDLDLDLDLLLLUUUURULDDRURURURURUURURURURURURURRURURURUUDDLDLDLDLDLDLDLDLDLDLDLDLUURRURURURURURURURURRRLDLLLDLDLDLDLDLDLDLDLDLDLDLDLDLDLULRRURURURURURURURURURURURURURURRRULDDLDLDLDLDLDLDLDLDLDLDLDLDL...

result:

ok AC

Test #28:

score: 0
Accepted
time: 4ms
memory: 4916kb

input:

20 20
01101111101111101110
11011010011010011010
10110110110110110110
11101101101101101101
10011011011011011001
10110110110110110111
01101101101101101101
11011011011011011011
10110110110110110110
11101101101101101101
10011011011011011001
10110110110110110111
01101101101101101101
11011011011011011011
...

output:

LLLLUUUUUULLRULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDDRUUUURUUDDLLDLDRRLDLDLULDLDLDLDLLLLDLDLDLDLDLDLDLUUUURURULDLDDRURURURURURUURUULLDLDLDLDLDLDLDLDRRRLLLLDRRURURURURURURURURURURURURURULLDLDLDLDLDLDLDLDLDLDLDLDLDLDLLUURURURURURURURURURURURURURURURURUULLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLL

result:

ok AC

Test #29:

score: 0
Accepted
time: 4ms
memory: 4856kb

input:

20 20
01111101111101110111
11010011010011010101
10110110110110110101
01101101101101101101
11011011011011011011
10110110110110110110
11101101101101101101
10011011011011011001
10110110110110110111
01101101101101101101
11011011011011011011
10110110110110110110
11101101101101101101
10011011011011011001
...

output:

LLLLUUUULLRULUUULLRULUUULLRULUUULLRULUUULLRULUUULLRULUUULLRULUUULLRULUUULLRULUULLRULLUULLRULLUULLULLRRUUUUULLRRUUUUULLRRUUUULLRRUULLURURURURURUUUUDDDDLUULDLDLDLDLDLDLDLUURDRRURURURURURUULLRURRRUULLDLDLDLDLDLDLDLDLDLDLDLDLLDLDLDLUURURURURURURURURURURURURURURUUUULLDDURRDDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLD...

result:

ok AC

Test #30:

score: 0
Accepted
time: 4ms
memory: 4948kb

input:

20 20
11011111011111011111
10110100110100110100
11101101101101101101
10011011011011011001
10110110110110110111
01101101101101101101
11011011011011011011
10110110110110110110
11101101101101101101
10011011011011011001
10110110110110110111
01101101101101101101
11011011011011011011
10110110110110110110
...

output:

LUUUULLLUURULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDDRUUUUULRUURUURRLLLLDLDLLDLDLDRRRLDLDLDLDLDLDLLLLDLDLDLDLDLDLLLUUUURULDDRURURURURUURURURURURURURURURURURULLRRDDLDLDLDLDLDLDLDLDLDLDLDLUURURURURURURURURURUULLRURURUULDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLLUURURURURURURURURURURURURURURURURRUU

result:

ok AC

Test #31:

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

input:

20 20
11110001110001110001
01011001011011011001
01101101101101101111
00110110110110110100
00011011011011011000
11101101101101101100
10110110110110110110
11011011011011011011
01101101101101101101
00110110110110110111
00011011011011011010
11101101101101101100
10110110110110110110
11011011011011011011
...

output:

LLLULLLULLLULLLULLLULLLULLLULLLULLLULLLULLLULULLLULULLLDLUULLLUULLLUULRURRDRDLLLULULLDRDRDRDRDRDRUUDRDDLLULULULULULULULULULLDRRRDRDRDRDRDRDRDRDRDRDRDRDRDRDLLRDLULULURDRDRRULULULULULULULULLURRDRDRDRDRDRDRDRDRRULULULULULULULULULULULULULULULLLRDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRUU

result:

ok AC

Test #32:

score: 0
Accepted
time: 4ms
memory: 4852kb

input:

20 20
11111110011110111110
00001011101011001011
11101100101101101100
10110110110110110111
11011011011011011010
01101101101101101111
10110110110110110101
10011011011011011011
11101101101101101100
10110110110110110111
11011011011011011010
01101101101101101111
10110110110110110010
10011011011011011011
...

output:

LLLLLLDDLLDDRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLDLUDLLLLULLLLLLRRRUUDLLULUULULUULLULLDDRDRUULLRRDRDRDRDRDLRDLLRDRUULULULULULULULULUULULULULULULUULLLLRDRRRRRDRRDDRDRDRDRDRDRDRDRDLLRDRDRDRDRDRRUULULULULULULULULULULULULUULLULLUUDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDDRLULULULULULULULULULULUL...

result:

ok AC

Test #33:

score: 0
Accepted
time: 4ms
memory: 4948kb

input:

20 20
11011111011111011111
10110100110100110100
11101101101101101101
10011011011011011001
10110110110110110111
01101101101101101101
11011011011011011011
10110110110110110110
11101101101101101101
10011011011011011001
10110110110110110111
01101101101101101101
11011011011011011011
10110110110110110110
...

output:

LUUUULLLUUDLUDRDLLLLUUDLUDRDLLLLUUDLUDRDLLLLUUDLUDRDLLLLUUDLUDRDLLLLUUDLUDRDLLLLDLULLDLULLDLULLDDLDLLLRRRRURURULLUURULDDRURURURURUURURRDDLDLDLDLDLDLUUDLDLDDRUUULRURURURURURURURURURURUURURURRDDLDLDLDLDLDLDLDLDLDLDLDLUUDLDLDDRURURURURURURURURURURURURURURURRRLDDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLLUU

result:

ok AC

Test #34:

score: 0
Accepted
time: 4ms
memory: 4904kb

input:

20 20
10111110111110111110
10001011001011001011
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011001
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011001
...

output:

UUUULLLLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUULLUULLUUDDDDRDRUURRDRDRDRDRDRDRRUULULULUULULUURRDRDRDRDRDRRUUDRDRDRDRDRDRRUULULULULULULULULULUULULUURRDRDRDRDRDRDRDRDRDRDRDRRUUDDRLUULULULULULULULULULULULULULULUUUDRRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDDLL

result:

ok AC

Test #35:

score: 0
Accepted
time: 4ms
memory: 4848kb

input:

20 20
11011100011100011101
10110110110110110111
11101101101101101101
01011011011011011010
00110110110110110111
01101101101101101101
11011011011011011011
10110110110110110110
11101101101101101100
10011011011011011010
10110110110110110111
01101101101101101101
11011011011011011011
10110110110110110110
...

output:

LUULLUULLRULRULULLRULRULULLRULRULULLRULRULULLRULRULULLRULRULULLRULRULULLRUURUUDLLURURUULLDLDLLDLDLLUURURURURRURURUULLDLDLDRRURURRDLDLDLDLDLDLDLDLLDLLUURURURURURURURURURURRURURUULURDDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLLUURURURURURURURURURURURDRURURURURURUULLDLDLDLDLDLDLDLDLDLDLDLDLDLDLUL

result:

ok AC

Test #36:

score: 0
Accepted
time: 3ms
memory: 5136kb

input:

20 20
11111111111111111111
10101010010101010101
10000000000000000000
11111111111111111111
00000000000000000001
11111111111111111111
10000000000000000000
11111111111111111111
00000000000000000001
11111111111111111111
10000000000000000000
11111111111111111111
00000000000000000001
11111111111111111111
...

output:

LLLLLLLLLLLLLLLLLLLUUULLLLLLLLLLLLLLLLLLLUUUDDDUURDDRRRRRRRRRRRRRRRRRRRUULLLLLLLLLLLLLLLLLLLUURDDRRRRRRRRRRRRRRRRRRRUULLLLLLLLLLLLLLLLLLLUURDDRRRRRRRRRRRRRRRRRRRUULLLLLLLLLLLLLLLLLLLUURDDRRRRRRRRRRRRRRRRRRRUU

result:

ok AC

Test #37:

score: 0
Accepted
time: 4ms
memory: 4848kb

input:

20 20
10011111011111011111
11100101100101100101
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011001
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011001
11101101101101101101
...

output:

UUULULUUULULUUULULUUULULUUULULUUULULUUULULUUULULUURLLULUUDDDDRDRDRUURRDRULLDRDRDRDRDLLRDRDDLLULULULULULULLULULLDRRRDRDRDRDRDRDRDRDRDRDLLRDLRDRDRDRDLLULULULULULULULULULULULULLULULLDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDDRRLULULULULULULULULULULULULULULULULULUL

result:

ok AC

Test #38:

score: 0
Accepted
time: 4ms
memory: 4852kb

input:

20 20
11000111110111110111
01001101001101001101
11011011011011011011
10110110110110110110
11101101101101101101
10011011011011011001
10110110110110110111
01101101101101101101
11011011011011011011
10110110110110110110
11101101101101101101
10011011011011011001
10110110110110110111
01101101101101101101
...

output:

LLLLULLUUULRUULLRULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDDRUUUUDLDLDRRRDRRURURULLRULDDDDLDLDLDLUUDLDLDLDLDLDLLUURURURURURURURUULLDLDLDLDLDLDLDLLUURRRDRRURURURURURURURURURURURURURRUUDDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLUURURURURURURURURURURURURURURURURUULLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLL

result:

ok AC

Test #39:

score: 0
Accepted
time: 4ms
memory: 4844kb

input:

20 20
10111110111110111011
11101001101001101010
10011011011011011010
10110110110110110111
01101101101101101101
11011011011011011011
10110110110110110110
11101101101101101100
10011011011011011010
10110110110110110111
01101101101101101101
11011011011011011011
10110110110110110110
11101101101101101100
...

output:

UUULULLLUURULUULLRULUULLRULUULLRULUULLRULUULLRULUULLRULUULLRULUULLRULUULLRULUULLDLLRURULUULLRULUULLRRUULLRRUULLRRUULLRRUULUUULDLDRURRDLDLDLDLDLDLDLLDLDDRRURURURULLDLDLDLDLDLDLDLDLLUURURURURURURURURURURUURULURRDDLDLDLDLDLDLDLDLDLDLDLDLDLUUDLDRURURURURURURURURURURURURURUULURRDLDLDLDLDLDLDLDLDLDLDLDLDL...

result:

ok AC

Test #40:

score: 0
Accepted
time: 4ms
memory: 4848kb

input:

20 20
11111011111011111011
00101100101100101101
10110110110110110111
10011011011011011001
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011001
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
...

output:

LLLLDDDDLLRDLRUURUUDRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRURUUDRUDRDLLULULULLULULULULULLLLULULULULULULLLLDDDDRDRDRDRDRDRDDLLULULULLRDRDRDRDRDDLLULULULULULULURRLURLLDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRUULULULULULULULULULULULULULULULULLUUDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDDLLULULULULULULULULULU...

result:

ok AC

Test #41:

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

input:

20 20
11111101111101110111
10010011010011011001
10110110110110110111
01101101101101101101
11011011011011011011
10110110110110110110
11101101101101101101
10011011011011011001
10110110110110110111
01101101101101101101
11011011011011011001
10110110110110110111
11101101101101101100
10011011011011011010
...

output:

LLLLLUUUULLLRULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULULLLRULULLRRUUUUUDLLDUURRURUULLDLDLDLDLDRRRLDLDLDLDLDLDLDLLDLDLLLLRRUURURURURURURURURURURURURURURUUUURURURRUUDDDDLUULDLDLDLDLDLDLDLDLDLDLDLDLDLUUDDLDDRURURURURURURURURURURURURURURURURULLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLLUURURURURURURU...

result:

ok AC

Test #42:

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

input:

20 20
00111110111110111110
01101001101001100011
11011011011011011110
10110110110110110001
01101101101101101111
11011011011011011001
10110110110110110111
11101101101101101100
10011011011011011001
10110110110110110111
01101101101101101101
11011011011011011011
10110110110110110110
11101101101101101101
...

output:

LLLLUUUULLLLDLULUUUDLULUUUDLULUUUDLULUUUDLULUUUDLULUUUDLULUUUDLULUUUDLULUUUDLULUUUDLULUUUDLDLLDDDLLUUUDLLDDLDLLLLUUUURURURURUUDLLDLDLDLDLLLLDDRUUULRURURURURURURURURURUURURURURURURUULLLRRRDLDLLDLDLDLDLDLDLDLDLDLDLDLUURURURURURURURURURURURURRUULLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLLURUURRURURURURURURURURU...

result:

ok AC

Test #43:

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

input:

20 20
11111011111011111011
00101100101100101101
10110110110110110111
10011011011011011001
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011001
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
...

output:

LLLLDDDDDLLRDLRUURUUDRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRURUUDRUDRDLLULULULLULULULULULLLLULULULULULULLLLDDDDRUURDRDRDRDRDRUUDRDDLLULULULULULULURRLURLLUDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRRUULULULULULULULULULULULULULULULULLUUDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDDLLULULULULULULULULULULULULULUL...

result:

ok AC

Test #44:

score: 0
Accepted
time: 3ms
memory: 4880kb

input:

20 20
00001110001110001110
00001011001011001011
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
00110110110110110111
00011011011011011000
11101101101101101100
10110110110110110110
11011011011011011011
01101101101101101101
00110110110110110111
00011011011011011000
...

output:

LLUULLUULLUULLUULLUULLUULLUULLUULLUULLUULLUULLUULLUULLUULLUULLUULLDDRDRDRDDLLULULULULULULLRRDRDRDRDRDRRUULULULULULULULULUUDDRDRDRDRDRDRDRDRDRDDLLULULULULULULULULULULULULLDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDDLLULULULULULURRDRDRDRDRDRRULULULULULULULULULULULLRRDRDRDRDRDRDRDRDRDRDRDRRUULULULULULULULULULULULUL...

result:

ok AC

Test #45:

score: 0
Accepted
time: 4ms
memory: 4792kb

input:

20 20
11111101111101111101
10010110010110010111
01011011011011011001
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011001
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
...

output:

LLLLLUUUURRRRRLURLDURLDURLDURLDURLDURLDURLDURLDURLDURLDURLDURLDDLUULLUULLLUULLLUULLLRRRRDLLRDLULLDRDRDRDRDRDRDLLRRUULULULULULULULDDULLUUUDDRDRDRDRDRDRDRDRDRDRDRDRDRUULLULULULULULULULLLRDRRRRDRDRDRDRDRDRDRDRDRDRDRDLLRDLUULULULULULULULULULULULULULLLUURDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRRUU

result:

ok AC

Test #46:

score: 0
Accepted
time: 4ms
memory: 4848kb

input:

20 20
11100011100011101100
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011010
11101101101101101100
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011010
11101101101101101100
10110110110110110110
...

output:

LLUULLUULLUULLUULLUULLUULLUULLUULLUULLUULLUULLUULLUULLUULLUULLUULLUUDLRURRDRDRDRDLLRRUULULULULDDDLLULLULULULULULULLUULULULULULULULLDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRUUDDLLULUULULULULULULULULULULULULLULULULULULLDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRUUDDLDRUULULULULULULULULULULULULDLULULULULUURRDRDRDRDRDRDR...

result:

ok AC

Test #47:

score: 0
Accepted
time: 4ms
memory: 5136kb

input:

20 20
11111000111000111011
00101101101101101110
10110110110110110011
10011011011011011010
11101101101101101100
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011010
11101101101101101100
10110110110110110110
11011011011011011011
01101101101101101101
...

output:

LLLLDLLDDDLULDURRURRLURLDURLDURLDURLDURLDURLDURLDURLDURLDURLDURLDURLDURLDLUUDLUUURULLRRDRDLULLDRDRDRDRDRDRDRDLLRRULULULULULULULUULRDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRRDDRURDLLLULULULULULULULULULULULULULULULDLRRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRRRUUUDLDLULULULULULULULULULULULULULULULLUU

result:

ok AC

Test #48:

score: 0
Accepted
time: 5ms
memory: 4852kb

input:

20 20
11101110111011101111
10111011101110111001
10010101010101010101
11101110111011101110
10111011101110111011
01010101010101010010
11101110111011101110
10111011101110111011
10010101010101010101
11101110111011101110
10111011101110111011
01010101010101010010
11101110111011101110
10111011101110111011
...

output:

LLUUUULLLRULULLUUURUDRUUUDLLDLLRRUULLRRUUUDLLDLLRRUULLRRUUUDLLDLLRRUULLRRUUUDLLDLLDLLDLLRRURRUUULLDLLULLDLLULLDLLULLDLLULLUUURULDDDRRDRRURRDRRURRDRRURRDRRURRUUULLDLLULLDLLULLDLLULLDLLULLUUURULDDDRRDRRURRDRRURRDRRURRDRRURRUUU

result:

ok AC

Test #49:

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

input:

20 20
11101110111011101110
10111011101110111011
10010101010101010101
11101110111011101110
10111011101110111011
01010101010101010010
11101110111011101110
10111011101110111011
10010101010101010101
11101110111011101110
10111011101110111011
01010101010101010010
11101110111011101110
10111011101110111011
...

output:

LLUUUULLRULULLUUURUDRUUULLDLLULLUUUDLLULLUUUDLLULLUUUDLLULLUUUDDDRURRDRRURRDRRURRDRRURRDRRURRUUUDDDDRDLUUULULLDLLULLDLLULLDLLULLDLLULLUUUDDDRRDRRURRDRRURRDRRURRDRRURRDDDDRDLUUULULLDLLULLDLLULLDLLULLDLLULLUUU

result:

ok AC

Test #50:

score: 0
Accepted
time: 5ms
memory: 4920kb

input:

20 20
11101111011011101111
10110101110010110010
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011010
11101101101101101101
10110110110110110111
11011011011011011001
01101101101101101101
10110110110110110111
11011011011011011001
01101101101101101101
10110110110110110110
...

output:

LLUULLLUUUULLLUUUULLLUULLUUUULLLUULLUUUULLLUULLUUUULLLUULLUUULLLUULLUUULLLUULLUULLUULLUULLDRRRUUDLLLLLLLDDLRDRRUUUDLLRDLRDLRDLDDRRRRUUDRDLRDRDRUUUDRDRDRDRDRDLLLLDDUUUUULLULULULULULUULULULULULULULULULULLUDDRDRDRDRDRDRDRDRDRDRDRDRDDRDRDRRUUULDDULULULULULULULULULULULULULULUURRDDRDRDRDRDRDRDRDRDRDRDRDRD...

result:

ok AC

Test #51:

score: 0
Accepted
time: 4ms
memory: 4944kb

input:

20 20
01000111011111011111
11101101100101100101
10110110110110110110
11011011011011011011
01101101101101101101
00110110110110110111
01011011011011011010
11101101101101101100
10110110110110110110
11011011011011011011
01101101101101101101
00110110110110110111
01011011011011011010
11101101101101101100
...

output:

ULULULULULULULULULULULULULUURULUURULUURULULURUDLDDRDRDRUURRDRULLDRDRDRDRDLLRDRURDDLLULULULULULULLULULULUURRDRDRDRDRDRDRDRDRDRDRDLLRDRDRDRDRDRRUULULULULULULULULULULULULULULUUDLURDRDRDRDRDRDRDRDRDRDRDRDRDRDRURDDLLULULULULULULULULULULULULULULULULLU

result:

ok AC

Test #52:

score: 0
Accepted
time: 4ms
memory: 4844kb

input:

20 20
11111011111011111011
00101100101100101101
10110110110110110111
10011011011011011001
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
00110110110110110111
10011011011011011001
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
...

output:

LLLLDDDDLLRDLRUURUUDRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRURUUDRUDRDLLULULULLULULULULULLLLULULULULULULLLLDDDRURDRDRDRDRDRUUDRDDLLULULULULULULURRLURLLUDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRRUULULULULULULULULULULULULULULULULLUUDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDDLULULULULULULULULULULULULULULULU...

result:

ok AC

Test #53:

score: 0
Accepted
time: 4ms
memory: 4848kb

input:

20 20
10111011111011111001
10101100101100101101
10110110110110110111
10011011011011011001
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011001
11101101101101101101
10110110110110110110
10011011011011011011
11101101101101101101
...

output:

UUUUUULLLLUUUUUULLUUUUUULLUUUUUULLUUUUUULLUUUUUULLUUUUUULLUUUUUULLUUUUUULLUUUUUULLUUUUUULLUUUUUULLUUUUUULLUUUULLUUUULLUUUULUULUUUURRRRDRDLLDDDRRLUURDRDRDRDRRUUDRDRDRRUULULULULULUULULULLDDDRDLUUURDRDRDRDRDRDRDRDRDRDRDRUUDRDRRUULULULULULULULULULULULUULULULULUURRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRRULULULULU...

result:

ok AC

Test #54:

score: 0
Accepted
time: 4ms
memory: 4884kb

input:

20 20
01111101111101111100
10010110010110010110
10011011011011011011
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
10011011011011011001
11101101101101101101
10110110110110110110
11011011011011011011
01101101101101101101
10110110110110110111
...

output:

LLLLUUUULLLLUULLLLUULLLLUULLLLUULLLLUULLLLUULLLLUULLLLUULLLLUULLLLUULLLLUULLLLUULLLLUULLUULLUULLUULLDDDDRUUDRULUURDRDRDRDRDRDRUUDDLLULULULULULULURRLLUUUDRRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRRUULULULULULULULULULULULULULULULULUUDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDDLLULULULULULULULULULULULULULULULULL

result:

ok AC

Test #55:

score: 0
Accepted
time: 3ms
memory: 4844kb

input:

20 20
01110001110001110000
11010011010011010000
10110110110110110111
01101101101101101101
11011011011011011011
10110110110110110110
11101101101101101100
00011011011011011000
00110110110110110111
01101101101101101101
11011011011011011011
10110110110110110110
11101101101101101100
00011011011011011000
...

output:

LLUUULLRULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULULLRRDDLDLUUDLDDRRURURURURURULLRRDDLDLDLUURURUULDLDLDLDLDLDLDLUUDLDDRRURURURURURURURURURURURULLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDDRRURDLLUUURURURURURURURURURURURURURURURUUDDLDLDLURURUULDLDLDLDLDLDLDLDLDLDLDLUURURURURURURURURUULDLDLDLDLDL...

result:

ok AC

Extra Test:

score: 0
Extra Test Passed