Fork Copy #include #define ROCK 1 #define NONE 0 using namespace std; int N; int maze[13][6]; int tempMaze[13][6]; int moveX[] = {-1,0,0}; int moveY[] = {0,1,-1}; int vis[16][6]; void initVis(){ for(int i=1;i<=N;i++){ for(int j=1;j<=5;j++){ vis[i][j] = 0; } } } void destroyRock(int row){ int ed = row - 2; if(row<=2){ ed = 1; } for(int i=row;i>=ed;i--){ for(int j=1;j<=5;j++){ maze[i][j] = NONE; } } } void reverseRock(int row){ int ed = row - 2; if(row<=2){ ed = 1; } for(int i=row;i>=ed;i--){ for(int j=1;j<=5;j++){ maze[i][j] = tempMaze[i][j]; } } } bool isValid(int x,int y){ if(x>=1&&x<=N&&y>=1&&y<=5) return true; return false; } int ans = 0; void Try(int row,int col,int numBomb,int score){ if(row==1){ //do smt; int temp = score; if(maze[row][col]==ROCK) temp-=1; else temp+=1; if(temp==21){ for(int i=1;i<=N;i++){ for(int j=1;j<=5;j++){ cout<ans){ // cout<>T; for(tc=1;tc<=T;tc++){ cin>>N; for(int i=1;i<=N;i++){ for(int j=1;j<=5;j++){ cin>>maze[i][j]; tempMaze[i][j] = maze[i][j]; } } ans = 0; initVis(); vis[N][3] = 1; Try(N,3,1,0); cout<