Cod sursa(job #724359)
| Utilizator | Data | 26 martie 2012 14:34:03 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 30 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.43 kb |
#include <cstdio>
#define NMax 1000000
char viz[NMax>>3];
int n,type,x;
int main() {
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
scanf("%d",&n);
for(long o=1;o<=n;o++) {
scanf("%d %d",&type,&x);
switch(type) {
case 1: viz[x>>3]|=1<<(x&7); break;
case 2: if(( viz[x>>3]>>(x&7) ) & 1) viz[x>>3]^=1<<(x&7); break;
case 3: printf("%d\n",( viz[x>>3]>>(x&7) ) & 1);
}
}
return 0;
}