Pagini recente » Cod sursa (job #1581926) | Cod sursa (job #1186370) | Cod sursa (job #622519) | Cod sursa (job #1771667) | Cod sursa (job #982563)
Cod sursa(job #982563)
#include<string.h>
#include<set>
#include<stdio.h>
#define MOD 666013
using namespace std;
set <int> hash[MOD];
set <int>::iterator it;
int main () {
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
int op,x,nop,flag;
scanf("%d",&nop);
while( nop ) {
scanf("%d%d",&op,&x);
if(op==1)
hash[x%MOD].insert(x);
if(op==2 && hash[x%MOD].find(x) != hash[x%MOD].end())
hash[x%MOD].erase(hash[x%MOD].find(x));
if(op==3) {
flag=hash[x%MOD].find(x) != hash[x%MOD].end();
printf("%d\n",flag);
}
nop--;
}
return 0;
}