QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#515170#2265. Short CodingAnotherDayofSun#AC ✓1ms3956kbC++203.2kb2024-08-11 15:41:062024-08-11 15:41:06

Judging History

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

  • [2024-08-11 15:41:06]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3956kb
  • [2024-08-11 15:41:06]
  • 提交

answer

#include<bits/stdc++.h>
#define For(i,j,k) for(int i=(j);i<=(k);i++)
#define foR(i,j,k) for(int i=(j);i>=(k);i--) 
#define vi vector<int>
#define pb push_back
#define pii pair<int,int> 
#define mkp make_pair
#define SZ(x) ((int)x.size())
using namespace std;
inline int read() {
	char c;int res=0;bool flag=0;
	while(c=getchar(),c<48)(c=='-')&&(flag=1);
	do res=(res<<3)+(res<<1)+(c^48);
	while(c=getchar(),c>47);
	flag&&(res=-res); return res; 
}
const int P=1e9+7; 
int add(int x,int y) {return (x+y)%P; }
int sub(int x,int y) {return (x-y+P)%P; }
int mul(int x,int y) {return 1ll*x*y%P; }
int addmod(int &x,int y) {return x=add(x,y); }
const int MN=10+5; 
const int dx[]={1,0,-1,0}; 
const int dy[]={0,-1,0,1}; 
char mp[MN][MN]; int n,m,op[MN],gt[MN],ok,sx,sy,ex,ey,lim;
int vis[1000005]; 
int hsh(int x,int y,int d,int h) {
	return h+d*lim+y*lim*4+x*lim*4*(m+1); 
}
void I(int &x) { x++; if(x==lim+1) x=1; }
void chk(int DEBUG=0) {
	memset(vis,0,sizeof(int)*(10+4*(n+1)*(m+1)*lim)); 
	int pc=1,d=0,nowx=sx,nowy=sy;
//	if(DEBUG) cerr<<"?";
//	#ifdef wasa855
//	if(DEBUG) {
//		For(i,1,lim) {
//			cout<<op[i]<<' '<<gt[i]<<endl;	
//		}
//	}
//	#endif
	while(nowx!=ex||nowy!=ey) {
		int st=hsh(nowx,nowy,d,pc); 
//		#ifdef wasa855
//		if(DEBUG) {
//			cout<<lim<<' '<<nowx<<' '<<nowy<<' '<<d<<' '<<pc<<endl;
//			cout<<nowx<<' '<<nowy<<endl;
//			cout<<endl;
//		}
//		#endif
		if(vis[st]) {
			return;
		}
		vis[st]=1; 
		if(op[pc]==0||op[pc]==4) {
			int nx=nowx+dx[d],ny=nowy+dy[d];
			if(mp[nx][ny]=='#') {I(pc); continue;} 
			if(op[pc]==0) nowx=nx,nowy=ny,I(pc); 
			else pc=gt[pc]; 
		} else if(op[pc]==1) {
			d++; if(d==4) d=0; 
			I(pc); 
		} else if(op[pc]==2) {
			d--; if(d==-1) d=3; 
			I(pc); 
		} else if(op[pc]==3) {
			pc=gt[pc]; 
		}
	}
	if(nowx==ex&&nowy==ey) ok=1; 
}
void dfs(int x) {
	if(x==lim+1) return chk();
	For(i,0,4) {
		op[x]=i;
		if(op[x]==2&&op[x-1]==1) continue; 
		if(op[x]==1&&op[x-1]==2) continue; 
		if(i>=3) {
			For(y,1,lim) {
				if(y!=x) {
					gt[x]=y; 
					dfs(x+1); 
					if(ok) return;
				}
			}
		} else {
			dfs(x+1); 
			if(ok) return;		
		}
		 
	}
}
void works() {
	n=read(),m=read();
	For(i,0,n+1) For(j,0,m+1) mp[i][j]='#'; 
	For(i,1,n) scanf("%s",mp[i]+1); 
	For(i,0,n+1) mp[i][m+1]='#'; 
	For(i,0,n+1) mp[i][0]='#';
	For(i,1,m) mp[0][i]='#';  
	For(i,1,m) mp[n+1][i]='#';
	For(i,1,n) For(j,1,m) {
		if(mp[i][j]=='S') {
			sx=i,sy=j; 
			mp[i][j]='.'; 		
		}
		if(mp[i][j]=='G') {
			ex=i,ey=j; 
			mp[i][j]='.'; 
		}
	}
//	For(i,1,n) For(j,1,m) {
//		cerr<<i<<' '<<j<<' '<<mp[i][j]<<endl;	
//	}
//	cerr<<sx<<' '<<sy<<' '<<ex<<' '<<ey<<endl;
	for(lim=1;lim<=6;lim++) {
		dfs(1); 
		if(ok) {
			printf("%d\n",lim); 
			For(i,1,lim) {
				if(op[i]==0) printf("FORWARD\n"); 
				if(op[i]==1) printf("RIGHT\n"); 
				if(op[i]==2) printf("LEFT\n"); 
				if(op[i]==3) printf("GOTO %d\n",gt[i]); 
				if(op[i]==4) printf("IF-OPEN %d\n",gt[i]); 
			}
//			chk(1); 
			return; 
		}	
	}
}
signed main() {
	#ifdef wasa855
		freopen("pro.in","r",stdin); 
		freopen("pro.out","w",stdout); 
	#endif
	int T=1;
	while(T--) {
		works(); 	
	}
	return 0; 	
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4 2
S#
.#
.#
G.

output:

1
FORWARD

result:

ok correct answer!

Test #2:

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

input:

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

output:

2
FORWARD
RIGHT

result:

ok correct answer!

Test #3:

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

input:

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

output:

2
FORWARD
LEFT

result:

ok correct answer!

Test #4:

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

input:

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

output:

3
FORWARD
FORWARD
LEFT

result:

ok correct answer!

Test #5:

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

input:

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

output:

3
FORWARD
LEFT
FORWARD

result:

ok correct answer!

Test #6:

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

input:

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

output:

3
LEFT
FORWARD
IF-OPEN 2

result:

ok correct answer!

Test #7:

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

input:

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

output:

3
RIGHT
FORWARD
IF-OPEN 2

result:

ok correct answer!

Test #8:

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

input:

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

output:

3
FORWARD
RIGHT
FORWARD

result:

ok correct answer!

Test #9:

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

input:

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

output:

3
RIGHT
FORWARD
FORWARD

result:

ok correct answer!

Test #10:

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

input:

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

output:

4
FORWARD
LEFT
FORWARD
RIGHT

result:

ok correct answer!

Test #11:

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

input:

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

output:

4
LEFT
FORWARD
RIGHT
FORWARD

result:

ok correct answer!

Test #12:

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

input:

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

output:

4
FORWARD
RIGHT
FORWARD
LEFT

result:

ok correct answer!

Test #13:

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

input:

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

output:

4
RIGHT
FORWARD
LEFT
FORWARD

result:

ok correct answer!

Test #14:

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

input:

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

output:

4
FORWARD
FORWARD
FORWARD
LEFT

result:

ok correct answer!

Test #15:

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

input:

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

output:

4
FORWARD
FORWARD
LEFT
FORWARD

result:

ok correct answer!

Test #16:

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

input:

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

output:

4
FORWARD
FORWARD
RIGHT
FORWARD

result:

ok correct answer!

Test #17:

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

input:

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

output:

4
FORWARD
LEFT
FORWARD
IF-OPEN 3

result:

ok correct answer!

Test #18:

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

input:

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

output:

4
FORWARD
RIGHT
FORWARD
IF-OPEN 3

result:

ok correct answer!

Test #19:

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

input:

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

output:

4
RIGHT
FORWARD
FORWARD
FORWARD

result:

ok correct answer!

Test #20:

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

input:

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

output:

4
RIGHT
FORWARD
LEFT
IF-OPEN 2

result:

ok correct answer!

Test #21:

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

input:

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

output:

2
FORWARD
RIGHT

result:

ok correct answer!

Test #22:

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

input:

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

output:

2
FORWARD
LEFT

result:

ok correct answer!

Test #23:

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

input:

2 4
...S
##G#

output:

2
FORWARD
LEFT

result:

ok correct answer!

Test #24:

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

input:

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

output:

2
FORWARD
RIGHT

result:

ok correct answer!

Test #25:

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

input:

2 3
#S#
..G

output:

2
FORWARD
LEFT

result:

ok correct answer!

Test #26:

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

input:

2 4
#.S#
#G##

output:

2
FORWARD
LEFT

result:

ok correct answer!

Test #27:

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

input:

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

output:

2
FORWARD
RIGHT

result:

ok correct answer!

Test #28:

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

input:

2 4
S.#.
#G##

output:

2
FORWARD
RIGHT

result:

ok correct answer!

Test #29:

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

input:

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

output:

2
FORWARD
RIGHT

result:

ok correct answer!

Test #30:

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

input:

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

output:

2
FORWARD
RIGHT

result:

ok correct answer!

Test #31:

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

input:

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

output:

3
LEFT
FORWARD
IF-OPEN 2

result:

ok correct answer!

Test #32:

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

input:

3 3
S..
##.
##G

output:

3
FORWARD
FORWARD
RIGHT

result:

ok correct answer!

Test #33:

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

input:

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

output:

3
FORWARD
IF-OPEN 1
LEFT

result:

ok correct answer!

Test #34:

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

input:

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

output:

3
FORWARD
FORWARD
LEFT

result:

ok correct answer!

Test #35:

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

input:

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

output:

3
FORWARD
FORWARD
RIGHT

result:

ok correct answer!

Test #36:

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

input:

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

output:

3
FORWARD
FORWARD
LEFT

result:

ok correct answer!

Test #37:

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

input:

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

output:

3
FORWARD
FORWARD
RIGHT

result:

ok correct answer!

Test #38:

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

input:

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

output:

3
FORWARD
IF-OPEN 1
LEFT

result:

ok correct answer!

Test #39:

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

input:

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

output:

3
FORWARD
FORWARD
RIGHT

result:

ok correct answer!

Test #40:

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

input:

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

output:

3
FORWARD
IF-OPEN 1
LEFT

result:

ok correct answer!

Test #41:

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

input:

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

output:

4
FORWARD
FORWARD
FORWARD
RIGHT

result:

ok correct answer!

Test #42:

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

input:

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

output:

4
FORWARD
FORWARD
LEFT
FORWARD

result:

ok correct answer!

Test #43:

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

input:

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

output:

4
FORWARD
IF-OPEN 4
LEFT
LEFT

result:

ok correct answer!

Test #44:

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

input:

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

output:

4
FORWARD
RIGHT
FORWARD
LEFT

result:

ok correct answer!

Test #45:

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

input:

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

output:

4
FORWARD
LEFT
FORWARD
RIGHT

result:

ok correct answer!

Test #46:

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

input:

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

output:

4
FORWARD
IF-OPEN 4
RIGHT
RIGHT

result:

ok correct answer!

Test #47:

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

input:

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

output:

4
FORWARD
FORWARD
FORWARD
LEFT

result:

ok correct answer!

Test #48:

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

input:

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

output:

4
RIGHT
FORWARD
IF-OPEN 1
RIGHT

result:

ok correct answer!

Test #49:

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

input:

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

output:

4
FORWARD
RIGHT
FORWARD
LEFT

result:

ok correct answer!

Test #50:

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

input:

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

output:

4
LEFT
FORWARD
RIGHT
IF-OPEN 2

result:

ok correct answer!

Test #51:

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

input:

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

output:

3
FORWARD
IF-OPEN 1
LEFT

result:

ok correct answer!

Test #52:

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

input:

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

output:

4
RIGHT
FORWARD
LEFT
FORWARD

result:

ok correct answer!

Test #53:

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

input:

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

output:

5
FORWARD
RIGHT
IF-OPEN 1
RIGHT
RIGHT

result:

ok correct answer!

Test #54:

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

input:

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

output:

3
RIGHT
FORWARD
IF-OPEN 2

result:

ok correct answer!

Test #55:

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

input:

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

output:

3
FORWARD
IF-OPEN 1
RIGHT

result:

ok correct answer!

Test #56:

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

input:

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

output:

3
FORWARD
IF-OPEN 1
RIGHT

result:

ok correct answer!

Test #57:

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

input:

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

output:

3
FORWARD
IF-OPEN 1
LEFT

result:

ok correct answer!

Test #58:

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

input:

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

output:

3
FORWARD
IF-OPEN 1
LEFT

result:

ok correct answer!

Test #59:

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

input:

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

output:

3
FORWARD
IF-OPEN 1
RIGHT

result:

ok correct answer!

Test #60:

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

input:

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

output:

1
FORWARD

result:

ok correct answer!

Test #61:

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

input:

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

output:

4
FORWARD
LEFT
FORWARD
RIGHT

result:

ok correct answer!

Test #62:

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

input:

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

output:

3
FORWARD
IF-OPEN 1
RIGHT

result:

ok correct answer!

Test #63:

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

input:

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

output:

3
FORWARD
IF-OPEN 1
RIGHT

result:

ok correct answer!

Test #64:

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

input:

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

output:

5
FORWARD
RIGHT
IF-OPEN 1
LEFT
GOTO 3

result:

ok correct answer!

Test #65:

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

input:

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

output:

5
FORWARD
LEFT
IF-OPEN 1
RIGHT
GOTO 3

result:

ok correct answer!

Test #66:

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

input:

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

output:

3
FORWARD
IF-OPEN 1
LEFT

result:

ok correct answer!

Test #67:

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

input:

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

output:

5
FORWARD
RIGHT
IF-OPEN 1
LEFT
GOTO 3

result:

ok correct answer!

Test #68:

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

input:

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

output:

3
FORWARD
IF-OPEN 1
RIGHT

result:

ok correct answer!

Test #69:

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

input:

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

output:

5
FORWARD
RIGHT
IF-OPEN 1
LEFT
GOTO 3

result:

ok correct answer!

Test #70:

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

input:

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

output:

5
FORWARD
LEFT
IF-OPEN 1
RIGHT
GOTO 3

result:

ok correct answer!

Test #71:

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

input:

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

output:

5
FORWARD
RIGHT
IF-OPEN 1
RIGHT
RIGHT

result:

ok correct answer!

Test #72:

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

input:

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

output:

3
FORWARD
IF-OPEN 1
LEFT

result:

ok correct answer!

Test #73:

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

input:

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

output:

4
FORWARD
LEFT
FORWARD
RIGHT

result:

ok correct answer!

Test #74:

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

input:

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

output:

3
FORWARD
IF-OPEN 1
RIGHT

result:

ok correct answer!

Test #75:

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

input:

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

output:

4
FORWARD
LEFT
FORWARD
RIGHT

result:

ok correct answer!

Test #76:

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

input:

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

output:

5
FORWARD
RIGHT
IF-OPEN 1
RIGHT
RIGHT

result:

ok correct answer!