QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#259405#8981. Kangaroo Puzzlehos_lyricAC ✓7ms5296kbC++143.7kb2023-11-20 21:41:112024-11-05 18:07:58

Judging History

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

  • [2024-11-05 18:07:58]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:AC
  • 用时:7ms
  • 内存:5296kb
  • [2024-11-05 18:07:55]
  • hack成功,自动添加数据
  • (/hack/1130)
  • [2023-11-20 21:41:11]
  • 评测
  • 测评结果:100
  • 用时:5ms
  • 内存:4944kb
  • [2023-11-20 21:41:11]
  • 提交

answer

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")


constexpr int DX[4] = {+1, 0, -1, 0};
constexpr int DY[4] = {0, +1, 0, -1};
constexpr char DRUL[5] = "DRUL";

int M, N;
char A[30][30];

int V;
int ids[30][30];
int graph[410][4];

int dist[410][410];
int prv[410][410];

int main() {
  for (; ~scanf("%d%d", &M, &N); ) {
    for (int x = 0; x < M; ++x) {
      scanf("%s", A[x]);
    }
    
    V = 0;
    memset(ids, ~0, sizeof(ids));
    for (int x = 0; x < M; ++x) for (int y = 0; y < N; ++y) if (A[x][y] == '1') {
      ids[x][y] = V++;
    }
    for (int x = 0; x < M; ++x) for (int y = 0; y < N; ++y) {
      const int u = ids[x][y];
      if (~u) {
        for (int dir = 0; dir < 4; ++dir) {
          const int xx = x + DX[dir];
          const int yy = y + DY[dir];
          graph[u][dir] = (0 <= xx && xx < M && 0 <= yy && yy < N && ~ids[xx][yy]) ? ids[xx][yy] : u;
        }
      }
    }
    
    queue<pair<int, int>> que;
    memset(dist, ~0, sizeof(dist));
    memset(prv, ~0, sizeof(prv));
    for (int u = 0; u < V; ++u) {
      dist[u][u] = 0;
      que.emplace(u, u);
    }
    for (; !que.empty(); ) {
      const int u = que.front().first;
      const int v = que.front().second;
      que.pop();
      for (int dir = 0; dir < 4; ++dir) {
        for (const int uu : {u, graph[u][dir ^ 2]}) if (graph[uu][dir] == u)
        for (const int vv : {v, graph[v][dir ^ 2]}) if (graph[vv][dir] == v)
        {
          if (!~dist[uu][vv]) {
            dist[uu][vv] = dist[u][v] + 1;
            prv[uu][vv] = dir;
            que.emplace(uu, vv);
          }
        }
      }
    }
    for (int u = 0; u < V; ++u) for (int v = 0; v < V; ++v) {
      assert(~dist[u][v]);
    }
    
    vector<int> us(V);
    for (int u = 0; u < V; ++u) {
      us[u] = u;
    }
    string ans;
    for (; us.size() > 1; ) {
      int mn = V * V;
      int um = -1, vm = -1;
      for (int i = 0; i < (int)us.size(); ++i) for (int j = i + 1; j < (int)us.size(); ++j) {
        if (chmin(mn, dist[us[i]][us[j]])) {
          um = us[i];
          vm = us[j];
        }
      }
      for (int u = um, v = vm; u != v; ) {
        const int dir = prv[u][v];
        ans += DRUL[dir];
        u = graph[u][dir];
        v = graph[v][dir];
        for (int &w : us) {
          w = graph[w][dir];
        }
      }
      sort(us.begin(), us.end());
      us.erase(unique(us.begin(), us.end()), us.end());
    }
    
    puts(ans.c_str());
  }
  return 0;
}

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

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 5008kb

input:

4 4
1111
1001
1001
1110

output:

LLLUUULLL

result:

ok AC

Test #2:

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

input:

2 15
111111111111111
101010101010101

output:

LLLLLLLLLLLLLLULLLLLLLLLLLLLL

result:

ok AC

Test #3:

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

input:

1 2
11

output:

L

result:

ok AC

Test #4:

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

input:

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

output:

UULUULULLDLULLLLULULLULLRUULRUULULLLULLRUUULRULDRRDDRUURRDLDULLLLLRRUUUURUUUUURURRRUDLLLDDLDDLLLURRRULLRRDRRRDDDLLDDDDDLDLLULLDRDDRDRDLDRDRRDLLL

result:

ok AC

Test #5:

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

input:

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

output:

UUULULLLUUULLLUUUUULLDLLULULLULDLLLLDLLULDLLRRDDLUUUUDRDDDULLURULLLLLDLLRURUUULLURRULLRUULUULLUUUUURUURDLDDDRRDDRUUURRRRDRUUUURLLUUURURDRRUUDDLLDLDRDDRDRUUDRRURURRRRRULRDDDDLDDLLDLLDDDLULDLULDDULLLUULLLLLULLL

result:

ok AC

Test #6:

score: 0
Accepted
time: 7ms
memory: 5296kb

input:

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

output:

LLUUULLUUULLUUULLULLDLLLLULLLULULUUDLDLDLRDLLDDDLLLDDRUURURDDLUUULLLUUULLUULLLDRRDDRUURUULLULLDRRUUUULUUDDRDRRRUUUDDLLLLLULULLRURUUULULLUURRUURRUURULLLDDRRDLLDDRRRURRUUUUURDDDRDDRRUUUUUUUDDDDDRRDRRULUUULDLLDDDLUURURRDLDRDRRRRRDDDDLLULLUUUUULLUULUULDLLUUU

result:

ok AC

Test #7:

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

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: 5276kb

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: 5032kb

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: 5292kb

input:

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

output:

LLLLLLLLULUULUULLUULLLUDDLLDLLLLRUUUUULLLRRUURRUUUURRRRUUUDLLLLLDRRLDLLDLUURULLUUUUUUDDLUDRRDLLRRURRDDLDRRLLDLLLLDLLURRDRRURRRDDRRURUUULULURU

result:

ok AC

Test #11:

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

input:

2 1
1
1

output:

U

result:

ok AC

Test #12:

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

input:

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

output:

LLLLLLLLLLLLLLLLLLLUUULLLLLLLLLLLLLLLLLLLUUDLLDDULLDLLULLDLLULLDLLULLDLLUUUDDRUURRRRRRRRRRRRRRRRRRRUUDDDLUUULLLLLLLLLLLLLLLLLLLUUDDRRRRRRRRRRRRRRRRRRRDDDLUUULLLLLLLLLLLLLLLLLLLUUDDRRRRRRRRRRRRRRRRRRRDDDLUUULLLLLLLLLLLLLLLLLLLUU

result:

ok AC

Test #13:

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

input:

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

output:

LLLLDDDDLLLRDLRURUUUDRURUUDRURUUDRURUUDRURUUDRURUUDRURUUDRURUUDRURUUDRURUUDRURUURUUDRDLLLRDLRDLRRRUUDRDLLLLULULULLRDDRDRDRDRUUDRUDRRDLLULULULULULULULULULLRDDRDRDRDRDRDRDRDRDRDRUUDRULLRDDLULULULULULULULULULULULULULULULLUUDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRRDDLLULULULULULULULULULULULULULULULULDL

result:

ok AC

Test #14:

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

input:

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

output:

LLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUUDLULULLDDULDLULDLDDRDRUURRDRDRDRDRDRDRRUULULULUURRDRDRDRDRDLLRDRDRDRDRDDLLULULULULULULULULULULULLULULUURRDRDRDRDRDRDRDRDRDRDRDRDRRUULULULULULULULULULUUDRDRDRDRDRDRDRDRDRDRDRRRDLUULULULULULULULULULULULULULULUUUDRRDRDRDRDRDR...

result:

ok AC

Test #15:

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

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: 4996kb

input:

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

output:

LLLUUUULLRULUUURULUUURULUUURULUUURULUUURULUUURULUUURULUUURULUUURULUUURULUUURULUUURULUUURULUUURULDLLURULRRUUDLURURUUUURURURURURURUUUURURURURURURUUUULLLDLLDLURRDLDLDLDLDLLDLDLDLDLDDRRURURURURULLRURURURRDLDLDLDLDLDLDLDLDLDLDLDLDLDLDDRRURURURURURURURURURURULLRURURURRDDLDLDLDLDLDLDLDLDLDLDLDLDLDLDDDURRUR...

result:

ok AC

Test #17:

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

input:

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

output:

ULULULULULULULULULULULULULUURULUURULUURULULURUDLDDRDRDRUUDDLLULULULUULULLDDRDRDRDRUULULULUURDRDRDRDRDRDRDRDRUUDDLLULULULULULULULULULUULULLRULDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDLLRDRULULULULULULULULULULULULULULULULURULLDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRUU

result:

ok AC

Test #18:

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

input:

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

output:

UUULULLLUDLLUUDLUDRLUDRLUDRLUDRLUDRLUDRLUDRLUDRLUDRLUDRLUDRLUDRLUDRLUDRRDLLLLRURURDDDRDDLDLDLDLUUUDLDLDLDDLLRRRRURURURULLDLDLDLDLDLDLDLDLDLDDLLUURURURURURURURURURURURURURURURURUULLDLDLDLDLDLDLDLDLDLDLDLDLDLLUURURURURURURURURURURURURURUULLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLLUURURURURURURURURURURURURURUR...

result:

ok AC

Test #19:

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

input:

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

output:

UUUULLLLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUULLUULLUUDDDDRDRUURRDRDRDRDRDRDRRUULULULUULULUURRDRDRDRDRDRRUUDRDRDRDRDRDRRUULULULULULULULULULUULULUURRDRDRDRDRDRDRDRDRDRDRDRRUUDDRLUULULULULULULULULULULULULULULLUURDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDDLL

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: 5016kb

input:

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

output:

LLLLDDDDDLLLRDLRUURUUDRUDLLLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLDLLRDLRDLRDLRDRUURUUUDDLLULULULLULULULULURRRLULULULULULULLLLULULULUULLDDDDRUURDRDRDRDRDRUUDRDDLLULULULULULULULURRRDRDRDRDRDRDRDRDRDRDRDRDRDRDRRUULULULULULULULULULULULUUDDRDRDRDRDRDRDRDRDRDRDRRRDDLULULULULULULULULULULULULULULULLLRDDRDRDR...

result:

ok AC

Test #22:

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

input:

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

output:

LLLLLLLLLLLLLLLLLLLUUULLLDLLDDULLDLLULLDLLLLLLLLUUULLDLLDDULLDLLULLDLLUUUDDRUURRRRRRRRRRRRRRRRRRRUUDDLDLURUULLLLLLLLLLLLLLLLLLLUUDDRRRRRRRRRRRRRRRRRRRDDLDLURUULLLLLLLLLLLLLLLLLLLUUDDRRRRRRRRRRRRRRRRRRRDDLDLURUULLLLLLLLLLLLLLLLLLLUU

result:

ok AC

Test #23:

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

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: 4940kb

input:

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

output:

LLLLDDDDLLRDLRUURUUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLDLLRDLRDLRDLRDLDLLRRUUDDLLULULULLULULULULURRRLULULULULULULLLLDDDDRDRDRDRDRDRDDLLULULULLRDRDRDRDRDDLLULULULULULULULURRRLLDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRUULULULULULULULULULULULULULULULULLUUDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDDLLULULULULULULU...

result:

ok AC

Test #25:

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

input:

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

output:

LLLLUUUULLLRULULLLRULULLLRULULLLRULULLLRULULLLRULULLLRULUUULLLRULUUULLLRULUUULLLRULUUULLLRULUUULLLRULULLLRULULLLRURDURUULLLDLDLDLLDLDLLLLDLDLDLDLDLDLLLLDLDLDLDLLDLDLLLLUUURDRURURURURURUURUULLDLDLDLDLDLDLDRRLDRLLLDDRURRRURURURURURURURURURURURURULLRULLLDDURRDLDLDLDLDLDLDLDLDLRRURURURURURURURUURRRRLDLD...

result:

ok AC

Test #26:

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

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: 5060kb

input:

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

output:

LUUUULLLLUURULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDDRUULLUUURURUULRUULLDLDLLDLDLDRRLDLDLDLDLDLDLLLLUUUURULDDRURURURURUURURURURURURRURURURURUUDDLDLDLDLDLDLDLDLDLDLDLDLUURRURURURURURURURURRRLDLLLDLDLDLDLDLDLDLDLDLDLDLDLDLDLULRRURURURURURURURURURURURURURUURRRLDDLDLDLDLDLDLDLDLDLDLDLDLDLDLD...

result:

ok AC

Test #28:

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

input:

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

output:

LLLLUUUUUULLRULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDDRUUUURUUDDLLDLDRRLDLDLULDLDLDLDLLLLDLDLDLDLDLDLDLUUUURURULDLDDRURURURURURUURUULLDLDLDLDLDLDLDRRLDRLLLLDRRURURURURURURURURURURURURURULLDLDLDLDLDLDLDLDLDLDLDLDLDLDLLUURURURURURURURURURURURURURURURURUULLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLL

result:

ok AC

Test #29:

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

input:

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

output:

LLLLUUUULLRULUUULLRULUUULLRULUUULLRULUUULLRULUUULLRULUUULLRULUUULLRULUUULLRULUULLRULLUULLRULLUULLULLRUURUUUUULLRUURUUULLRRUURURURURURUUUUDDDDLUULDLDLDLDLDLDLDLUURDRRURURURURURUULLRURUURRLLDLDLDLDLDLDLDLDLDLDLDLDLLDLDLDLUURURURURURURURURURURURURURURUUUULLDDURRDDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDDLLD

result:

ok AC

Test #30:

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

input:

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

output:

LUUUULLLUURULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDDRUUUUULRUURUURRLLLLDLDLLDLDRRLDRLDLDLDLDLDLDLLLLDLDLDLDLDLDLLLUUUURULDDRURURURURUURURURURURURURURURURURULLRRDDLDLDLDLDLDLDLDLDLDLDLDLUURURURURURURURURURUULLRURURUULDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLLUURURURURURURURURURURURURURURURURURU

result:

ok AC

Test #31:

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

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: 5ms
memory: 4944kb

input:

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

output:

LLLLLLDDLLDDRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLDLUDLLLLULLLLLLRUURRDLLRDRDRDRDDLLRUURRLLLLULDRRULULULULULLDDRDRDRUURDRDRDRDRDLLRDRDRDRDRDRDRDRDRDRDRUULLULULULULULULULULULULULULULLUUDDRRDRDRDRDRDRRRLULLLLLLULULULULULULULULULULULDLRRRRDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDDLLULULULULULULU...

result:

ok AC

Test #33:

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

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: 5016kb

input:

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

output:

UUUULLLLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUUUULLUULLUULLUUDDDDRDRUURRDRDRDRDRDRDRRUULULULUULULUURRDRDRDRDRDRRUUDRDRDRDRDRDRRUULULULULULULULULULUULULUURRDRDRDRDRDRDRDRDRDRDRDRRUUDDRLUULULULULULULULULULULULULULULLUURDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDDLL

result:

ok AC

Test #35:

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

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: 5000kb

input:

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

output:

LLLLLLLLLLLLLLLLLLLUUULLLLLLLLLLLLLLLLLLLUUUDDDUURDDRRRRRRRRRRRRRRRRRRUURLLLLLLLLLLLLLLLLLLLUURDDRRRRRRRRRRRRRRRRRRUURLLLLLLLLLLLLLLLLLLLUURDDRRRRRRRRRRRRRRRRRRUURLLLLLLLLLLLLLLLLLLLUURDDRRRRRRRRRRRRRRRRRRUUR

result:

ok AC

Test #37:

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

input:

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

output:

UUULULUUULULUUULULUUULULUUULULUUULULUUULULUUULULUURLLULUUDDDDRDRDRUURRDRULLDRDRDRDRDLLRDRDDLLULULULULULULLULULLDRRRDRDRDRDRDRDRDRDRDRDLLRDLRDRDRRDDLLULULULULULULULULULULULULLULULLDDRDRDRDRDRDRDRDRDRDRDRDRDRDRRRDDLULULULULULULULULULULULULULULULULULUL

result:

ok AC

Test #38:

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

input:

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

output:

LLLLULLUUULRUULLRULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDDRUUUUDLDRRLDRDRRURURULLRULDDDDLDLDLDLUUDLDLDLDLDLDLLUURURURURURURURUURURURURURURURURURUUDDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLUUDLLRURDRRURURURURURURURURURURURURURRUUDDLLDDLDLDLDLDLDLDLDLDLDLDLDLDLLULDDRURURURURURURURURURURURURURUR...

result:

ok AC

Test #39:

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

input:

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

output:

UUULULLLUURULUULLRULUULLRULUULLRULUULLRULUULLRULUULLRULUULLRULUULLRULUULLRULUULLDLLRURULUULLRULUULLRUURRUULLRUURUULULLDLDRURRDLDLDLDLDLDLDLLDLDDRRURURURULLDLDLDLDLDLDLDLDLLUURURURURURURURURURURUURULURRDDLDLDLDLDLDLDLDLDLDLDLDLDLUUDLDRURURURURURURURURURURURURURUULURRDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDL...

result:

ok AC

Test #40:

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

input:

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

output:

LLLLDDDDLLRDLRUURUUDRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRURUUDRUDRDLLULULULLULULULULULLLLULULULULULULLLLDDDDRDRDRDRDRDRDDLLULULULLRDRDRDRDRDDLLULULULULULULULURRRLLDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRUULULULULULULULULULULULULULULULULLUUDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDDLLULULULULULULULULULU...

result:

ok AC

Test #41:

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

input:

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

output:

LLLLLUUUULLLRULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULULLLRULULLRRUUUUUDLLDUURRURUULLDLDLDLDRRLDRLDLDLDLDLDLDLDLLDLDLLLLRRUURURURURURURURURURURURURURURUUUURURURRUUDDDDLUULDLDLDLDLDLDLDLDLDLDLDLDLDLUUDDLDDRURURURURURURURURURURURURURURURURULLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLLUURURURURURURU...

result:

ok AC

Test #42:

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

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: 4ms
memory: 5036kb

input:

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

output:

LLLLDDDDDLLRDLRUURUUDRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRURUUDRUDRDLLULULULLULULULULULLLLULULULULULULLLLDDDDRUURDRDRDRDRDRUUDRDDLLULULULULULULULURRRLLLRDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRRUULULULULULULULULULULULULULULULULLUUDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDDLLULULULULULULULULULULULULULUL...

result:

ok AC

Test #44:

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

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: 3ms
memory: 5012kb

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: 5068kb

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: 4940kb

input:

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

output:

LLLLDLLDDDLULDURRURRLURLDURLDURLDURLDURLDURLDURLDURLDURLDURLDURLDURLDURLDLUUDLUUURULLRRDRDLULLDRDRDRDRDRDRDRDLLRRULULULULULULULUULRDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRRRDDURDLLLULULULULULULULULULULULULULULULDLRRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRRRUUUDLDLULULULULULULULULULULULULULULULLUU

result:

ok AC

Test #48:

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

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: 5076kb

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: 5068kb

input:

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

output:

LLUULLLUUUULLLUUUULLLUULLUUUULLLUULLUUUULLLUULLUUUULLLUULLUUULLLUULLUUULLLUULLUULLUULLUULLDRRUURDRRULDRDRRRUUUDRDRDLLLLDDULDRDRDRRUUDRDRDRDRUURDRDRDLLLLLLLDDUUUUULLULULULULULUULULULULULLDDRDRDRDDRDRDRDRDRDRRUUUDRDRDRDRDRDRDRRUULULULULULULULULULULULULDDULURDRDRDRDRDRDRDRDRDRDRDRDDDRRRRDDLULULULULULUL...

result:

ok AC

Test #51:

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

input:

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

output:

ULULULULULULULULULULULULULUURULUURULUURULULURUDLDDRDRDRUURRDRULLDRDRDRDRDLLRDRURDDLLULULULULULULLULULULUURRDRDRDRDRDRDRDRDRDRDRDLLRDRDRDRDRDRRUULULULULULULULULULULULULULULUURULDDRDRDRDRDRDRDRDRDRDRDRDRDRDRURDDLLULULULULULULULULULULULULULULULULLU

result:

ok AC

Test #52:

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

input:

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

output:

LLLLDDDDLLRDLRUURUUDRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRURUUDRUDRDLLULULULLULULULULULLLLULULULULULULLLLDDRDRDRDRDRDRUUDRUDRDDLLULULULULULULULURRRLLDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRUULULULULULULULULULULULULULULULULLUUDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDDLULULULULULULULULULULULULULULULULDL

result:

ok AC

Test #53:

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

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: 5020kb

input:

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

output:

LLLLUUUULLLLUULLLLUULLLLUULLLLUULLLLUULLLLUULLLLUULLLLUULLLLUULLLLUULLLLUULLLLUULLLLUULLUULLUULLUULLDDDDRUUDRULUURDRDRDRDRDRDRUUDDLLULULULULULULURRLLLUURDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRRUULULULULULULULULULULULULULULULULUUDDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDDLLULULULULULULULULULULULULULULULULL

result:

ok AC

Test #55:

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

input:

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

output:

LLUUULLRULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULRDULULLRRDDLDLUUDLDDRRURURURURURULLRRDDLDLDLUURURUULDLDLDLDLDLDLDLUUDLDDRRURURURURURURURURURURURULLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDRRDURDLLUUURURURURURURURURURURURURURURURUUDDLDLDLURURUULDLDLDLDLDLDLDLDLDLDLDLUURURURURURURURURUULDLDLDLDLDL...

result:

ok AC

Extra Test:

score: 0
Extra Test Passed