Pagini recente » Cod sursa (job #1061757) | Cod sursa (job #2359570) | Cod sursa (job #2667463) | Cod sursa (job #1778820) | Cod sursa (job #2037606)
#include <cstdio>
#include <vector>
#include <set>
using namespace std;
const int M=666013;
vector < set <int> > T;
set <int>::iterator it;
int h(int key){
return key%M;
}
int main()
{
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
int n;
int op,x;
scanf("%d",&n);
T.resize(M+5);
for(int y=1;y<=n;++y)
{
scanf("%d%d",&op,&x);
int key=h(x);
if(op==1)
T[key].insert(x);
else
{
it=T[key].find(x);
if(op==2){
if(it != T[key].end())
T[key].erase(it);
}
if(op==3){
if(it != T[key].end())
printf("1\n");
else
printf("0\n");
}
}
}
return 0;
}