#if !__INCLUDE_LEVEL__ #include __FILE__ const char DIR[4] = {'D', 'R', 'L', 'U'}; void output(vector &ans){ for( char c : ans){ cout << c; } cout << endl; } vector> seen; map> dir2num; ll h,w,p; void bfs(vector> &is_wall, vector &ans, int curX, int curY) { if (ans.size() >= 400) { return; } char skip_dir; if(ans.size()>0){ switch ( ans.back()) { case 'L' : skip_dir='R'; break; case 'U' : skip_dir='D'; break; case 'R' : skip_dir='L'; break; case 'D' : skip_dir='U'; break; } } else{ skip_dir=' '; } for (int i = 0; i < 2; i++){ for (char dir : DIR ){ if (dir == skip_dir ){ continue; } int nxtX = dir2num[dir].first+curX; int nxtY = dir2num[dir].second+curY; if(nxtX < 0 || h <= nxtX || nxtY < 0 || w <= nxtY ){ continue; } if(seen[nxtX][nxtY] > 2){ continue; } seen[nxtX][nxtY]++; ans.push_back(dir); ll score; do{ output(ans); cin >> score; if (score == -1) { exit(0); } }while(score> h >> w >> p; vector> is_wall(h-1, vector(w-1)); seen.resize(h, vector(w)); dir2num['U'] = pair(-1, 0); dir2num['L'] = pair( 0,-1); dir2num['D'] = pair(+1, 0); dir2num['R'] = pair( 0,+1); vector ans; bfs(is_wall, ans, 0, 0); return 0; } //====================temp==================== #else #include using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define RREP(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define REPITR(itr, ARRAY) for (auto itr = (ARRAY).begin(); itr != (ARRAY).end(); ++itr) #define RREPITR(itr, ARRAY) for (auto itr = (ARRAY).rbegin(); itr != (ARRAY).end(); ++itr) #define ALL(n) (n).begin(),(n).end() using ll = long long; using ull = unsigned long long; //#define int long long template struct edge{ int to; T cost; edge(){} edge(int to, T cost):to(to), cost(cost){} }; #endif