this is my code my 1 test case is wrong and 1 is showing TLE and rest test cases are passed succesfullt please tell me mistake
// #include
using namespace std;
bool rat(char arr[][1000],int sol[][1000],int i,int j,int n,int m)
{
if(i==n-1&&j==m-1)
{
sol[i][j]=1;
for(i=0;i<n;i++){
for(j=0;j<m;j++){
cout<<sol[i][j]<<" ";
}
cout<<endl;
}
cout<<endl;
return true;
}
if(i>n||j>m)
return false;
if(arr[i][j]==‘X’)
{
return false;
}
sol[i][j]=1;
bool right=rat(arr,sol,i,j+1,n,m);
bool down=rat(arr,sol,i+1,j,n,m);
sol[i][j]=0;
if(right||down)
return true;
return false;
}
int main() {
int n,m;
int sol[1000][1000]={0};
cin>>n>>m;
char arr[1000][1000];
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
cin>>arr[i][j];
}
bool ans=rat(arr,sol,0,0,n,m);
if(ans==false)
cout<<"-1";
return 0;
}