CENS20A _logic

#include
using namespace std;

int main() {
int n=0,m=0,i,j;
cin>>n>>m;
int a[n][m];
string s;
for(i=1;i<=n;i++)
{
cin>>s;
for(j=0;j<m;j++)
{
a[i][j]=s[j];
}
}
long int q=0;
cin>>q;
while(q–)
{
int x1=0,y1=0,x2=0,y2=0;
cin>>x1>>y1>>x2>>y2;
for(i=x1;i<=x2;i++)
{
for(j=y1;j<=y2;j++)
{
if(a[i][j]==0)
a[i][j]=1;
else
a[i][j]=0;
}
}
}
for(i=1;i<=n;i++)
{
for(j=0;j<m;j++)
{
cout<<a[i][j];
}
cout<<"\n";
}
// your code goes here
return 0;
}
WHAT IS WRONG WITH THIS LOGIC PLZZ TELL??

The wrong thing is time complexity it’s an O(Q*N * M) solution , the question requires a less amount of time complexity

Don’t confuse Time limit exceeded with Wrong Answer