#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
using namespace std;
#define PF(x) (scanf("%d",&x))
#define PT(x,y) (scanf("%d%d",&x,&y))
#define PR(x) (printf("%d\n",x))
#define PRT(x,y)(printf("%d %d\n",x,y))
#define M 105
int arr[M][M][M];
int n,m;
int maxx(int x,int y)
{
return x>y?x:y;
}
int minx(int x,int y)
{
return x>y?y:x;
}
int low(int x)
{
return x&(-x);
}
void add(int x,int y,int z,int c)
{
int t=y;
int tt = z;
for(x;x<M;x+=low(x))
for(t = y;t<M;t+=low(t))
for(tt = z;tt<M;tt+=low(tt))
arr[x][t][tt]+=c;
}
int sums(int x,int y,int z)
{
int sumt = 0;
int t;
int tt;
for(;x;x-=low(x))
for(t=y;t;t-=low(t))
for(tt = z;tt;tt-=low(tt))
sumt += arr[x][t][tt];
return sumt;
}
void init()
{
int q;
while(scanf("%d%d",&n,&m)!=EOF)
{
memset(arr,0,sizeof(arr));
char ch[10];
int x,y,z,xx,yy,zz;
for(int i=0;i<m;i++){
scanf("%s",ch);
if(ch[0] == '1')
{
scanf("%d%d%d%d%d%d",&x,&y,&z,&xx,&yy,&zz);
add(x,y,z,1);xx++,yy++,zz++;
add(xx,y,z,-1);add(x,yy,z,-1);add(x,y,zz,-1);
add(xx,yy,z,1);add(xx,y,zz,1);add(x,yy,zz,1);
add(xx,yy,zz,-1);
}
else
{
scanf("%d%d%d",&x,&y,&z);
printf("%d\n",sums(x,y,z)%2?1:0);
}
}
}
return ;
}
int main()
{
init();
return 0;
}
hdu 3584
最新推荐文章于 2019-08-03 10:54:07 发布