这题,我真草他妈了,一眼就秒的题,我草复测竟然TLE了,我草,早知道我把update改成n,m了,我去,打了这三场比赛我是涨记性了,以后打的时候就得注意细节,细节,细节,细节,。。。。。。。我真草了,好不容易一次上分的机会,我去。。。。。。。。我。。。。。。。。。。。。。
#include <ctime>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <numeric>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const int maxn = 510;
int arr[maxn][maxn];
ll mat[maxn][maxn];
int T, n, m, q;
int lowbit(int x) {
return x & (-x);
}
void update(int x, int y, int d) {
for(int i = x; i <= n; i += lowbit(i))
for(int j = y; j <= m; j += lowbit(j))
mat[i][j] ^= d;
}
ll sum(int x, int y) {
ll res = 0;
for(int i = x; i > 0; i -= lowbit(i))
for(int j = y; j > 0; j -= lowbit(j))
res ^= mat[i][j];
return res;
}
int main() {
//freopen("aa.in", "r", stdin);
int opt;
int x1, y1, x2, y2;
int x, y, z;
scanf("%d", &T);
while(T--) {
scanf("%d %d %d", &n, &m, &q);
memset(mat, 0, sizeof(mat));
for(int i = 1; i <= n; ++i) {
for(int j = 1; j <= m; ++j) {
scanf("%d", &x);
arr[i][j] = x;
update(i, j, x);
}
}
while(q--) {
scanf("%d", &opt);
if(opt == 1) {
scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
ll ans = 0;
ans ^= sum(x2, y2);
if(y1 > 1) ans ^= sum(x2, y1 - 1);
if(x1 > 1) ans ^= sum(x1 - 1, y2);
if(x1 > 1 && y1 > 1) ans ^= sum(x1 - 1, y1 - 1);
if(ans == 0) {
printf("No\n");
} else {
printf("Yes\n");
}
} else {
scanf("%d %d %d", &x, &y, &z);
update(x, y, arr[x][y]^z);
arr[x][y] = z;
}
}
}
return 0;
}