#include<bits/stdc++.h>
using namespace std;
int n,m,a[501][501],d[501][501],q;
int main(){
cin>>n>>m>>q;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin>>a[i][j];
d[i][j]=a[i][j]-a[i-1][j]-a[i][j-1]+a[i-1][j-1];
}
}
for(int i=1;i<=q;i++){
int x1,y1,x2,y2;
cin>>x1>>y1>>x2>>y2;
d[x1][y1]+=1;
d[x2+1][y1]-=1;
d[x1][y2+1]-=1;
d[x2+1][y2+1]+=1;
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
d[i][j]+=d[i-1][j]+d[i][j-1]-d[i-1][j-1];
cout<<d[i][j]%2<<" ";
}
cout<<"\n";
}
return 0;
}
非常水的一题,二维差分模板写完直接模2输出就行。