Pagini recente » Cod sursa (job #2891302) | Cod sursa (job #2013850) | Cod sursa (job #1648069) | Cod sursa (job #2058631) | Cod sursa (job #982569)
Cod sursa(job #982569)
#include<string.h>
#include<vector>
#include<stdio.h>
#define MOD 666013
using namespace std;
vector <int> hash[MOD];
vector <int>::iterator it;
int main () {
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
int op,rest,x,nop,flag;
scanf("%d",&nop);
while( nop ) {
scanf("%d%d",&op,&x);
rest=x%MOD;
if(op==1)
hash[rest].push_back(x);
if(op==2) {
for(it=hash[rest].begin(); it!=hash[rest].end(); it++)
if(*it==x) {
hash[rest].erase(it);
break;
}
}
if(op==3) {
flag=0;
for(it=hash[rest].begin(); it!=hash[rest].end() && !flag; it++)
if(*it==x)
flag=1;
printf("%d\n",flag);
}
nop--;
}
return 0;
}