#include #include #include #include #include #include using namespace std; int x[39][39]; int n; int dx[] = {1,0,-1,0}; int dy[] = {0,1,0,-1}; struct node { int x,y,len,dir; int move; } re[19]; bool oor(int x,int y) { if(x<0||x>29) return false; if(y<0||y>29) return false; return true; } bool stop[19],cash[19]; int map_move[39][39]; void init() { int l,r,c; char d[5]; memset(map_move,-1,sizeof(map_move)); memset(x,false,sizeof(x)); for(int i=0; i0) { re[i].x-=dx[re[i].dir]; re[i].y-=dy[re[i].dir]; re[i].len--; if(re[i].len<=0) re[i].move = 0; } } if(map_move[re[i].x][re[i].y]!=-1&&map_move[re[i].x][re[i].y]!=i) { re[map_move[re[i].x][re[i].y]].move = 0; re[i].move = 0; x[re[i].x][re[i].y] = true; } map_move[re[i].x][re[i].y]=i; map_move[re[i].x-dx[re[i].dir]*(re[i].len)][re[i].y-dy[re[i].dir]*(re[i].len)]=-1; } } } cout<<" 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2"<