//kindly tell me what the problem is with this code
#include
using namespace std;
bool rat_in_maze(char maze[][1000],int soln[][1000],int i,int j,int m,int n){
if(i==m and j==n){
soln[m][n]=1;
for(int h=0;h<=m;h++){
for(int p=0;p<=n;p++){
cout<<soln[h][p]<<" ";
}
cout<<endl;
}
cout<<endl;
return true;
}
if(i>m or j>n){
return 0;
}
if(maze[i][j]=='X'){
return 0;
}
soln[i][j]=1;
bool right= rat_in_maze(maze,soln,i,j+1,m,n);
if(right){
soln[i][j]=0;
return true;
}
bool down= rat_in_maze(maze,soln,i+1,j,m,n);
if(down){
soln[i][j]=0;
return true;
}
//soln[i][j]=0;
return 0;
}
int main(){
char maze[1000][1000];
int soln[1000][1000]={0};
int m,n;
cin>>m>>n;
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
cin>>maze[i][j];
}
}
rat_in_maze(maze,soln,0,0,m-1,n-1);
return 0;
}