QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#396701#2265. Short Codinghos_lyricAC ✓2ms3960kbC++144.3kb2024-04-23 03:10:442024-04-23 03:10:45

Judging History

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

  • [2024-04-23 03:10:45]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:3960kb
  • [2024-04-23 03:10:44]
  • 提交

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};

int GOTO(int l) { return 0 + l; }
int IF(int l) { return 8 + l; }
constexpr int FORWARD = 16;
constexpr int LEFT = 17;
constexpr int RIGHT = 18;

int M, N;
char A[11][11];
int SY, TY;

bool check(const vector<int> &prog) {
  bool vis[11][11][4][6] = {};
  for (int x = 0, y = SY, dir = 0, pc = 0; ; ) {
// cerr<<"  "<<prog<<": "<<x<<" "<<y<<" "<<dir<<" "<<pc<<endl;
    if (x == M - 1 && y == TY) return true;
    if (vis[x][y][dir][pc]) return false;
    vis[x][y][dir][pc] = true;
    const int op = prog[pc];
    if (0 <= op && op < 8) {
      pc = op - 0;
    } else if (8 <= op && op < 16) {
      const int xx = x + DX[dir];
      const int yy = y + DY[dir];
      if (0 <= xx && xx < M && 0 <= yy && yy < N && A[xx][yy] != '#') {
        pc = op - 8;
      } else {
        ++pc;
      }
    } else if (op == FORWARD) {
      const int xx = x + DX[dir];
      const int yy = y + DY[dir];
      if (0 <= xx && xx < M && 0 <= yy && yy < N && A[xx][yy] != '#') {
        x = xx;
        y = yy;
      }
      ++pc;
    } else if (op == LEFT) {
      ++dir &= 3;
      ++pc;
    } else if (op == RIGHT) {
      --dir &= 3;
      ++pc;
    } else {
      assert(false);
    }
    if (pc == (int)prog.size()) pc = 0;
  }
}


vector<int> ans;
int L;
vector<int> ops;
vector<int> prog;
void dfs(int l) {
  if (l == L) {
    if (check(prog)) {
      ans = prog;
    }
  } else {
    for (const int op : ops) {
      prog[l] = op;
      dfs(l + 1);
      if (ans.size()) return;
    }
  }
}

int main() {
  for (; ~scanf("%d%d", &M, &N); ) {
    for (int x = 0; x < M; ++x) {
      scanf("%s", A[x]);
    }
    SY = TY = -1;
    for (int y = 0; y < N; ++y) if (A[0][y] == 'S') SY = y;
    for (int y = 0; y < N; ++y) if (A[M - 1][y] == 'G') TY = y;
    
#ifdef LOCAL
cerr<<"["<<__LINE__<<"] "<<check({FORWARD,LEFT})<<endl;
cerr<<"["<<__LINE__<<"] "<<check({IF(2),LEFT,FORWARD})<<endl;
cerr<<"["<<__LINE__<<"] "<<check({RIGHT,RIGHT,FORWARD,GOTO(1)})<<endl;
cerr<<"["<<__LINE__<<"] "<<check({LEFT,FORWARD,RIGHT,FORWARD,IF(3)})<<endl;
#endif
    
    ans.clear();
    for (L = 1; L <= 4; ++L) {
      ops.clear();
      for (int l = 0; l < L; ++l) ops.push_back(GOTO(l));
      for (int l = 0; l < L; ++l) ops.push_back(IF(l));
      ops.push_back(FORWARD);
      ops.push_back(LEFT);
      ops.push_back(RIGHT);
      prog.resize(L);
      dfs(0);
      if (ans.size()) break;
    }
    if (!ans.size()) {
      ans = {LEFT, IF(4), RIGHT, GOTO(1), FORWARD};
      assert(check(ans));
    }
    
    printf("%d\n", (int)ans.size());
    for (const int op : ans) {
      if (0 <= op && op < 8) {
        printf("GOTO %d\n", (op - 0) + 1);
      } else if (8 <= op && op < 16) {
        printf("IF-OPEN %d\n", (op - 8) + 1);
      } else if (op == FORWARD) {
        puts("FORWARD");
      } else if (op == LEFT) {
        puts("LEFT");
      } else if (op == RIGHT) {
        puts("RIGHT");
      } else {
        assert(false);
      }
    }
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4 2
S#
.#
.#
G.

output:

1
FORWARD

result:

ok correct answer!

Test #2:

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

input:

3 6
##S..#
#..##.
.G..#.

output:

2
FORWARD
RIGHT

result:

ok correct answer!

Test #3:

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

input:

3 7
....S##
.#.#...
##.#.G#

output:

2
FORWARD
LEFT

result:

ok correct answer!

Test #4:

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

input:

4 8
...S.#.#
##..#.#.
###...#.
#.#.#G.#

output:

3
FORWARD
FORWARD
LEFT

result:

ok correct answer!

Test #5:

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

input:

3 5
.S#..
.....
..#G.

output:

3
FORWARD
LEFT
FORWARD

result:

ok correct answer!

Test #6:

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

input:

10 10
.....S#...
...#......
....##....
.#.....#..
....#.....
..#.......
...#......
..........
.#...#....
G.#..#...#

output:

3
LEFT
FORWARD
IF-OPEN 2

result:

ok correct answer!

Test #7:

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

input:

7 9
.##S.#..#
.........
.........
...#...##
###..####
........#
.....##G#

output:

3
RIGHT
FORWARD
IF-OPEN 2

result:

ok correct answer!

Test #8:

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

input:

3 9
..#.#.#S#
#...#...#
.G....#.#

output:

3
FORWARD
RIGHT
FORWARD

result:

ok correct answer!

Test #9:

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

input:

4 5
#S...
..#..
.#..#
.#.G#

output:

3
RIGHT
FORWARD
FORWARD

result:

ok correct answer!

Test #10:

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

input:

6 8
..S..#.#
...#...#
....#..#
#.#.##..
.......#
.#..#G.#

output:

4
FORWARD
LEFT
FORWARD
RIGHT

result:

ok correct answer!

Test #11:

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

input:

9 10
S.........
.#..#....#
........#.
..........
.....#.#..
.#...#....
#..#.##.#.
..#..#...#
..#.#....G

output:

4
LEFT
FORWARD
RIGHT
FORWARD

result:

ok correct answer!

Test #12:

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

input:

10 4
#.S.
.#.#
##.#
##..
.#..
#...
#.##
..#.
.#..
G.##

output:

4
FORWARD
RIGHT
FORWARD
LEFT

result:

ok correct answer!

Test #13:

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

input:

9 9
#..#...S#
.#...##.#
.....##..
..#..#...
..#..#..#
.#..#.#.#
.###.....
..#.#.##.
G#....#.#

output:

4
RIGHT
FORWARD
LEFT
FORWARD

result:

ok correct answer!

Test #14:

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

input:

7 3
.S#
#..
..#
...
..#
.#.
.G.

output:

4
FORWARD
FORWARD
FORWARD
LEFT

result:

ok correct answer!

Test #15:

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

input:

6 6
..#S..
#.#.#.
.....#
#.#...
..#...
..G##.

output:

4
FORWARD
FORWARD
LEFT
FORWARD

result:

ok correct answer!

Test #16:

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

input:

6 8
....#S..
......#.
..##..#.
###.#.##
..#...#.
##.G#..#

output:

4
FORWARD
FORWARD
RIGHT
FORWARD

result:

ok correct answer!

Test #17:

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

input:

10 8
#..S.###
.#....##
.#......
....#.#.
#...#..#
........
....#.##
...#.###
.#.#...#
.#...G.#

output:

4
FORWARD
LEFT
FORWARD
IF-OPEN 3

result:

ok correct answer!

Test #18:

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

input:

7 6
...##S
#.....
....#.
...#.#
....#.
#.....
.....G

output:

4
FORWARD
RIGHT
FORWARD
IF-OPEN 3

result:

ok correct answer!

Test #19:

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

input:

4 8
.##..S..
#.###..#
.#...#..
...#G...

output:

4
RIGHT
FORWARD
FORWARD
FORWARD

result:

ok correct answer!

Test #20:

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

input:

3 10
##.......S
####.####.
...#..G##.

output:

4
RIGHT
FORWARD
LEFT
IF-OPEN 2

result:

ok correct answer!

Test #21:

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

input:

2 7
.#S.###
.#.G..#

output:

2
FORWARD
LEFT

result:

ok correct answer!

Test #22:

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

input:

2 7
.S#.#.#
G#.##.#

output:

2
FORWARD
LEFT

result:

ok correct answer!

Test #23:

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

input:

2 4
...S
##G#

output:

2
FORWARD
LEFT

result:

ok correct answer!

Test #24:

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

input:

2 7
S......
.G.....

output:

2
FORWARD
LEFT

result:

ok correct answer!

Test #25:

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

input:

2 3
#S#
..G

output:

2
FORWARD
LEFT

result:

ok correct answer!

Test #26:

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

input:

2 4
#.S#
#G##

output:

2
FORWARD
LEFT

result:

ok correct answer!

Test #27:

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

input:

3 6
.#S###
#....#
#G.#..

output:

2
FORWARD
LEFT

result:

ok correct answer!

Test #28:

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

input:

2 4
S.#.
#G##

output:

2
FORWARD
RIGHT

result:

ok correct answer!

Test #29:

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

input:

2 5
##..S
...G.

output:

2
FORWARD
LEFT

result:

ok correct answer!

Test #30:

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

input:

2 9
#S###....
G..##..##

output:

2
FORWARD
RIGHT

result:

ok correct answer!

Test #31:

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

input:

6 10
....S...##
.#...#....
..........
.#.#...#..
...#.##...
.G#...#...

output:

3
LEFT
FORWARD
IF-OPEN 2

result:

ok correct answer!

Test #32:

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

input:

3 3
S..
##.
##G

output:

3
IF-OPEN 3
RIGHT
FORWARD

result:

ok correct answer!

Test #33:

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

input:

5 5
..S..
.##..
.####
..#..
G.#.#

output:

3
IF-OPEN 3
LEFT
FORWARD

result:

ok correct answer!

Test #34:

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

input:

4 6
S#....
....#.
#.....
#...G.

output:

3
IF-OPEN 3
LEFT
FORWARD

result:

ok correct answer!

Test #35:

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

input:

3 6
.#..S#
..#..#
.##G.#

output:

3
IF-OPEN 3
RIGHT
FORWARD

result:

ok correct answer!

Test #36:

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

input:

4 3
..S
.#.
..#
G..

output:

3
IF-OPEN 3
LEFT
FORWARD

result:

ok correct answer!

Test #37:

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

input:

5 3
S..
##.
...
...
.G.

output:

3
IF-OPEN 3
RIGHT
FORWARD

result:

ok correct answer!

Test #38:

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

input:

8 2
.S
..
..
..
..
..
.#
G.

output:

3
IF-OPEN 3
LEFT
FORWARD

result:

ok correct answer!

Test #39:

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

input:

3 7
...#..S
#.#....
....G..

output:

3
IF-OPEN 3
LEFT
FORWARD

result:

ok correct answer!

Test #40:

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

input:

3 9
#......S.
...#.#...
.G.#.#...

output:

3
IF-OPEN 3
LEFT
FORWARD

result:

ok correct answer!

Test #41:

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

input:

2 9
.##..S...
##..##G.#

output:

4
IF-OPEN 3
LEFT
FORWARD
RIGHT

result:

ok correct answer!

Test #42:

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

input:

4 6
S..#.#
..#...
......
..#G#.

output:

4
FORWARD
FORWARD
LEFT
FORWARD

result:

ok correct answer!

Test #43:

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

input:

4 9
#..##S..#
##..#...#
#.......#
####.#G##

output:

4
IF-OPEN 3
LEFT
LEFT
FORWARD

result:

ok correct answer!

Test #44:

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

input:

3 8
....S...
.....#..
..#G#...

output:

4
FORWARD
RIGHT
FORWARD
LEFT

result:

ok correct answer!

Test #45:

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

input:

4 9
.#.S#####
..#.###..
.#....#.#
.####.G.#

output:

4
FORWARD
LEFT
FORWARD
RIGHT

result:

ok correct answer!

Test #46:

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

input:

4 3
..S
...
...
#G#

output:

4
IF-OPEN 3
LEFT
LEFT
FORWARD

result:

ok correct answer!

Test #47:

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

input:

2 7
#...S..
..#G##.

output:

4
IF-OPEN 3
RIGHT
FORWARD
LEFT

result:

ok correct answer!

Test #48:

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

input:

5 6
...S..
...#..
...#..
...#.#
#G..#.

output:

4
RIGHT
FORWARD
IF-OPEN 1
RIGHT

result:

ok correct answer!

Test #49:

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

input:

4 8
.#...#.S
..###...
........
....G..#

output:

4
FORWARD
IF-OPEN 4
LEFT
LEFT

result:

ok correct answer!

Test #50:

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

input:

3 4
#S..
##..
.#G#

output:

4
IF-OPEN 3
LEFT
FORWARD
RIGHT

result:

ok correct answer!

Test #51:

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

input:

4 6
#.S.#.
#..#..
..#...
..G##.

output:

3
IF-OPEN 3
LEFT
FORWARD

result:

ok correct answer!

Test #52:

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

input:

4 5
#..S.
#.#..
..#..
G#..#

output:

4
RIGHT
FORWARD
LEFT
FORWARD

result:

ok correct answer!

Test #53:

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

input:

5 5
#.#S#
#...#
##.##
##..#
.##.G

output:

5
LEFT
IF-OPEN 5
RIGHT
GOTO 2
FORWARD

result:

ok correct answer!

Test #54:

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

input:

5 6
##S..#
...#..
...#.#
...#..
..#G.#

output:

3
RIGHT
FORWARD
IF-OPEN 2

result:

ok correct answer!

Test #55:

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

input:

6 4
...S
..#.
....
....
....
G...

output:

3
IF-OPEN 3
LEFT
FORWARD

result:

ok correct answer!

Test #56:

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

input:

5 6
....S.
......
......
....#.
....G.

output:

3
IF-OPEN 3
LEFT
FORWARD

result:

ok correct answer!

Test #57:

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

input:

4 5
S###.
.####
.####
..G##

output:

3
IF-OPEN 3
LEFT
FORWARD

result:

ok correct answer!

Test #58:

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

input:

6 5
...S.
...#.
.#...
..##.
.##..
.G#..

output:

3
IF-OPEN 3
LEFT
FORWARD

result:

ok correct answer!

Test #59:

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

input:

5 4
..S.
#...
.#..
..#.
G...

output:

3
IF-OPEN 3
RIGHT
FORWARD

result:

ok correct answer!

Test #60:

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

input:

5 5
..#S#
.#..#
....#
..#.#
###G.

output:

1
FORWARD

result:

ok correct answer!

Test #61:

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

input:

10 10
#...S..#..
..#...#...
..#.#.#...
...#....##
##.....#.#
.....#.##.
.....#...#
...###....
..#.#.....
.#.#....#G

output:

4
FORWARD
LEFT
FORWARD
RIGHT

result:

ok correct answer!

Test #62:

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

input:

10 10
.#..S#...#
.....#....
...#...#.#
.##..#....
#....###.#
........##
...#..#...
##.#....##
...#....#.
#.#G...#.#

output:

3
IF-OPEN 3
RIGHT
FORWARD

result:

ok correct answer!

Test #63:

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

input:

10 10
.......S..
..........
..........
..........
........#.
..........
..........
..........
..........
........G.

output:

3
IF-OPEN 3
LEFT
FORWARD

result:

ok correct answer!

Test #64:

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

input:

10 10
....#S.#.#
.#....#...
.....#..#.
....#..#..
.#.....#.#
.......###
#....#.#..
..........
.#.#.##...
#....G.#..

output:

5
LEFT
IF-OPEN 5
RIGHT
GOTO 2
FORWARD

result:

ok correct answer!

Test #65:

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

input:

10 10
#...#..#.S
.##..#....
..###.#...
##.##.##..
#.#..##..#
.##.##...#
..#.##..#.
...#...##.
.#.#....##
#.##..G##.

output:

5
LEFT
IF-OPEN 5
RIGHT
GOTO 2
FORWARD

result:

ok correct answer!

Test #66:

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

input:

10 10
.........S
..........
..#.......
..........
.....#....
.#........
..........
..........
.......#..
.G.......#

output:

3
IF-OPEN 3
LEFT
FORWARD

result:

ok correct answer!

Test #67:

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

input:

10 10
.....#...S
...#....#.
......#.##
..#......#
#.#.##.#..
..#.##.#..
.......#..
#...#.....
#.#....#..
.#...#..#G

output:

5
LEFT
IF-OPEN 5
RIGHT
GOTO 2
FORWARD

result:

ok correct answer!

Test #68:

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

input:

10 10
......S...
..........
..........
..........
..........
...#....#.
..........
#.....#...
..........
.....#G...

output:

3
IF-OPEN 3
RIGHT
FORWARD

result:

ok correct answer!

Test #69:

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

input:

10 10
......##S.
........#.
....###...
....#.#..#
.##....#.#
.....#....
.....#....
..##......
....#.#.#.
.#....G...

output:

5
LEFT
IF-OPEN 5
RIGHT
GOTO 2
FORWARD

result:

ok correct answer!

Test #70:

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

input:

10 10
#.S#..#...
.......#.#
#..##..#.#
#...#...#.
#.###..##.
.....#.#.#
#.#..#...#
..##.#.#.#
####..#...
##..G#.#.#

output:

5
LEFT
IF-OPEN 5
RIGHT
GOTO 2
FORWARD

result:

ok correct answer!

Test #71:

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

input:

10 10
S#...#....
.#.#.#.##.
.#.#.#.#..
.#.#.#.#.#
.#.#.#.#..
.#.#.#.##.
.#.#.#.#..
.#.#.#.#.#
.#.#.#.#..
...#...##G

output:

5
LEFT
IF-OPEN 5
RIGHT
GOTO 2
FORWARD

result:

ok correct answer!

Test #72:

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

input:

10 10
S#..#...#.
.#.....#..
.#.....#..
.........#
##.#.#.#..
.#.#.#.#..
.#.#.#.#.#
.#.#.#.#..
.#.#.#.#..
...#...#.G

output:

3
IF-OPEN 3
LEFT
FORWARD

result:

ok correct answer!

Test #73:

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

input:

10 10
S.#.#.#.#.
#..#.#.#.#
.#..#.#.#.
#.#..#.#.#
.#.#..#.#.
#.#.#..#.#
.#.#.#..#.
#.#.#.#..#
.#.#.#.#..
#.#.#.#.#G

output:

4
FORWARD
LEFT
FORWARD
RIGHT

result:

ok correct answer!

Test #74:

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

input:

10 10
S.........
.########.
.#......#.
.#......#.
.#......#.
.#......#.
.#......#.
.#......#.
.########.
.........G

output:

3
IF-OPEN 3
LEFT
FORWARD

result:

ok correct answer!

Test #75:

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

input:

10 10
S.#.......
#.###.####
#......#.#
##.###....
.#.#...#.#
...#####.#
.#.#.#...#
.#.#...###
##.#####.#
.........G

output:

4
FORWARD
LEFT
FORWARD
RIGHT

result:

ok correct answer!

Test #76:

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

input:

10 10
S.#.......
#.###.####
#......#.#
##.###....
.#.#...#.#
...#####.#
.#.#.#...#
.#.#...###
##.#####.#
G.........

output:

5
LEFT
IF-OPEN 5
RIGHT
GOTO 2
FORWARD

result:

ok correct answer!