RAT IN A MAZE--runtime error in test cases

link to ques–https://hack.codingblocks.com/contests/c/457/398

#include
using namespace std;

bool rat (char maze[10][10],int sol[][10],int i,int j,int m,int n)
{
if(i==m && j==n)
{
sol[m][n]=1;
for(int i=0;i<=m;i++)
{
for(int j=0;j<=n;j++)
cout<<sol[i][j]<<" ";
cout<<endl;
}

	return true;
}

if(i>m ||j>n)
	return false;
if(maze[i][j]=='X')
	return false;

sol[i][j]=1;

bool right=rat(maze,sol,i,j+1,m,n);
bool down;
if(right==false){
 down=rat(maze,sol,i+1,j,m,n);}
sol[i][j]=0;

if(right || down)
	return true;

return false;

}

int main()
{
int m,n;
cin>>m>>n;

char maze[10][10];
for(int i=0;i<m;i++)
	{
		for(int j=0;j<n;j++)
			cin>>maze[i][j];
	}
int sol[10][10]={0};
bool ans=rat(maze,sol,0,0,m-1,n-1);	

if(ans==false)
	cout<<"-1";
return 0;

}

You must be getting run time error as you fixed the size of 2 array to 10 X 10 but this is mentioned that its size is upto 1000 X 1000. So just increase its size

Make the char array and the solution array of 1000 x 1000 as in hacker block it is the given constraint and also make the both array global.

https://ide.codingblocks.com/s/55815 I am getting run-error in 4 cases and wrong answer in one. Please Help