Pagini recente » Cod sursa (job #1676850) | Cod sursa (job #2443446) | Cod sursa (job #1439916) | Cod sursa (job #3039649) | Cod sursa (job #2306068)
#include<cstdio>
#define M 1000001
typedef struct O
{
int I;
struct O *U;
}N;
int n,y,x,o;
N *h[M],*p,*q;
int main()
{
freopen("hashuri.in","r",stdin),freopen("hashuri.out","w",stdout),scanf("%d",&n);
while(n--)
{
scanf("%d%d",&x,&y);
for(o=0,p=h[y%M];p&&!o;p=p->U)
if(p->I==y)
o=1;
if(x==1)
{
if(!o)
{
p=new N;
p->U=h[y%M],p->I=y,h[y%M]=p;
}
}
else if(x==2)
{
if(o)
{
for(p=q=h[y%M];p&&p->I!=y;q=p,p=p->U);
q->U=p->U;
}
}
else
printf("%d\n",o);
}
}