Pagini recente » Cod sursa (job #909917) | Cod sursa (job #988628) | Cod sursa (job #2875538) | Cod sursa (job #1038632) | Cod sursa (job #2036819)
//#include<bits/stdc++.h>
#include <cstdio>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
const int m=666013;
int h (int key)
{
return key%m;
}
vector<int>v[m+5];
vector<int>::iterator it;
int main()
{
freopen("hashuri.in","r",stdin);
freopen("hashuri.out ","w",stdout);
int n,i,j,tip,k,x,help;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d%d",&tip,&x);
help=h(x);
if(tip==1) { it=find(v[help].begin(),v[help].end(),x);
if(it==v[help].end()) v[help].push_back(x);}
else if(tip==2) {
// v[h(x)].erase(find(v[h(x)].begin,v[h(x)].end,x));
it=find(v[help].begin(),v[help].end(),x);
if(it!=v[help].end()) v[help].erase(it);
}
else
{
it=find(v[help].begin(),v[help].end(),x);
if(it!=v[help].end()) printf("1\n");
else printf("0\n");
}
}
return 0;
}