Pagini recente » Cod sursa (job #2271241) | Cod sursa (job #2756259) | Cod sursa (job #650372) | Rating Dumitru Razvan (callas100) | Cod sursa (job #539159)
Cod sursa(job #539159)
#include<stdio.h>
#include<vector>
using namespace std;
int n,i,j,x,op,ok,poz;
const int p=666013;
vector<int> h[p];
int main()
{
freopen("hashuri.in",""r,stdin);
freopen("hashuri.out","w",stdout);
scanf("%d",&n);
while(n--)
{
scanf("%d%d",&op,&x);
if(op==1)
{
for(i=0;i<h[x%p].size();i++)
if(x==h[x%p][i])
ok=1;
if(ok==0)
h[x%p].push_back(x);
}
if(op==2)
{
for(i=0;i<h[x%p].size();i++)
if(x==h[x%p][i])
ok=1,poz=i;
if(ok==1)
swap(h[x%p][poz],h[x%p][h[x%p].size()-1]),h[x%p].pop_back(x);
}
if(op==3)
{
for(i=0;i<h[x%p].size();i++)
if(x==h[x%p][i])
ok=1;
if(ok==1)printf("1\n");
else printf("0\n");
}
ok=0;
}
return 0;
}