Pagini recente » Cod sursa (job #2673859) | Cod sursa (job #995002) | Cod sursa (job #762004) | Cod sursa (job #1044997) | Cod sursa (job #1533314)
#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;
h[x%666013].erase(h[x%666013].begin()+pos);
}
if(op==3)
{
printf("%d\n",(gaseste(x)>0));
}
}
}