/*三维树状数组*/ #include<stdio.h> #include<string.h> #define N 105 int tree[N][N][N]; int n; int lowbit(int x) { return x&(-x); } void tree_change(int x,int y,int z) { int flagy,flagz; while(x <= n){ flagy = y; while(flagy <= n){ flagz = z; while(flagz <= n){ tree[x][flagy][flagz] += 1; flagz += lowbit(flagz); } flagy += lowbit(flagy); } x += lowbit(x); } printf("/n"); } int get_sum(int x,int y,int z) { int sum = 0; int flagy,flagz; while(x >= 1){ flagy = y; while(flagy >= 1){ flagz = z; while(flagz >= 1){ sum += tree[x][flagy][flagz]; flagz -= lowbit(flagz); } flagy -= lowbit(flagy); } x -= lowbit(x); } return sum; } int main() { int m; int c; int x1,y1,z1,x2,y2,z2; while(scanf("%d %d",&n,&m) == 2){ memset(tree,0,sizeof(tree)); while(m--){ scanf("%d",&c); if(c){ scanf("%d %d %d %d %d %d",&x1,&y1,&z1,&x2,&y2,&z2); tree_change(x1,y1,z1); tree_change(x2+1,y1,z1); tree_change(x1,y2+1,z1); tree_change(x2+1,y2+1,z1); tree_change(x1,y1,z2+1); tree_change(x2+1,y1,z2+1); tree_change(x1,y2+1,z2+1); tree_change(x2+1,y2+1,z2+1); } else{ scanf("%d %d %d",&x1,&y1,&z1); printf("%d/n",get_sum(x1,y1,z1)%2); } } } return 0; } //想了我好久,还是不是很明白,这题一定得写个解题报告才行,等我想通后再补