Pagini recente » Cod sursa (job #639827) | Cod sursa (job #15257) | Cod sursa (job #692351) | Cod sursa (job #1076343) | Cod sursa (job #1533320)
#include<cstdio>
#include<vector>
using namespace std;
vector<int> h[666013];
int i,n,op,x,pos;
int gaseste(int x)
{
int it;
for(it=0;it<h[x%666013].size();it++)
{
if(h[x%666013][it]==x)
{
return it+1;
}
}
return 0;
}
int main()
{
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d%d",&op,&x);
if(op==1)
{
if(!gaseste(x))
{
h[x%666013].push_back(x);
}
}
if(op==2)
{
pos=gaseste(x)-1;
if(pos!=-1)
{
h[x%666013].erase(h[x%666013].begin()+pos);
}
}
if(op==3)
{
printf("%d\n",(gaseste(x)>0));
}
}
}