Pagini recente » Cod sursa (job #1282343) | Cod sursa (job #1977971) | Cod sursa (job #2885132) | Cod sursa (job #1124464) | Cod sursa (job #2040931)
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
const int M=666013;
vector <int> G[M+5];
vector <int>::iterator it;
//it=find(v.begin() , v.end() , x);
int h(int key)
{
return key%M;
}
int main()
{
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
int i, N, op, x, hs;
scanf("%d", &N);
for(i=1 ; i<=N ; i++)
{
scanf("%d%d", &op, &x);
hs = h(x);
if(op==1)
G[hs].push_back(x);
else if(op==2)
{
it=find(G[hs].begin() , G[hs].end() , x);
if(it != G[hs].end())
G[hs].erase(it);
}
else
{
it=find(G[hs].begin() , G[hs].end() , x);
if(it != G[hs].end())
printf("1\n");
else
printf("0\n");
}
}
return 0;
}