Pagini recente » Cod sursa (job #1261591) | Cod sursa (job #280971) | Cod sursa (job #856849) | Cod sursa (job #1231083) | Cod sursa (job #631672)
Cod sursa(job #631672)
#include<stdio.h>
#include<vector>
using namespace std;
int i1,i,n,l,t,x,r;
vector<int> h[666013];
vector<int>::iterator it;
int main()
{
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
scanf("%d",&n);
for(i1=1;i1<=n;i1++)
{
scanf("%d",&t);
scanf("%d",&x);
r=x%666013;
if(t==1)
{
//l=h[r].size();
for(it=h[r].begin();it!=h[r].end();it++)
if(*it==x) break;
if(it==h[r].end()) h[r].push_back(x);
}
else
if(t==3)
{
for(it=h[r].begin();it!=h[r].end();it++)
if(*it==x) break;
if(it==h[r].end()) printf("0");
else printf("1");
printf("\n");
}
else
{
for(it=h[r].begin();it!=h[r].end();it++)
if(*it==x) break;
if(it!=h[r].end()) h[r].erase(it);
}
}
return 0;
}