Pagini recente » Cod sursa (job #209241) | Cod sursa (job #2513923) | Cod sursa (job #2127722) | Cod sursa (job #1925903) | Cod sursa (job #1048173)
#include <iostream>
#include<cstdio>
#include<vector>
#define H 100003
using namespace std;
vector<int> h[H];
int n,x,y,k;
int main()
{
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
cin>>n;
for(;n;n--)
{
cin>>x>>y;
k=y%H;
vector<int>::iterator it;
for(it=h[k].begin();it!=h[k].end();it++)
if(*it==y)
break;
if(x==1)
{
if(it==h[k].end())
h[k].push_back(y);
}
else
if(x==2)
{
if(it!=h[k].end())
{
*it=h[k].back();
h[k].pop_back();
}
}
else
if(it==h[k].end())
cout<<"0\n";
else
cout<<"1\n";
}
return 0;
}