> File Name: 5892.cpp > Author: jiangyuzhu > Mail: 834138558@qq.com > Created Time: 2016/9/24 11:12:42 ************************************************************************/ #include<iostream> #include<cstdio> #include<cstring> #include<queue> #include<vector> #include<set> #include<map> #include<algorithm> using namespace std; const int maxn = 3e3 + 5; typedef long long ll; ll bit[2][2][maxn][maxn]; int n; void Add(int x, int y, ll val) { for (int i = x; i <= n; i += i & (-i)) { for (int j = y; j <= n; j += j & (-j)){ bit[x & 1][y & 1][i][j] ^= val; } } } ll Query(int x, int y) { ll res = 0; for(int i = x; i; i -= i & (-i)){ for(int j = y; j; j -= j & (-j)){ res ^= bit[x & 1][y & 1][i][j]; } } return res; } char s[10 + 5]; int main (void) { int m;scanf("%d%d", &n, &m); int a, b, c, d; int k; int x, y; memset(bit, 0 ,sizeof(bit)); for(int i = 0; i < m; ++i){ scanf("%s", s); if(s[0] == 'P'){ ll dt = 0; scanf("%d%d%d%d%d", &a, &b, &c, &d, &k); for(int j = 0; j < k; ++j){ scanf("%d%d", &x, &y); if(y & 1) dt ^= 1ll << (x - 1); } Add(a, b, dt); Add(a, d + 1, dt); Add(c + 1, b, dt); Add(c + 1, d + 1, dt); }else{ scanf("%d%d%d%d", &a, &b, &c, &d); ll res = Query(c, d) ^ Query(a - 1, d) ^ Query(c, b - 1) ^ Query(a - 1, b - 1); for(int i = 0; i < 50; i++){ if((res >> i) & 1) printf("2 "); else printf("1 "); } puts(""); } } return 0; }
|