Pagini recente » Cod sursa (job #1231237) | Cod sursa (job #693268) | Cod sursa (job #1716976) | Cod sursa (job #1879677) | Cod sursa (job #1048175)
//#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);
scanf("%d",&n);//cin>>n;
for(;n;n--)
{
scanf("%d%d",&x,&y);//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
it==h[k].end()?printf("0\n"):printf("1\n");
//cout<<"0\n";
//else
//cout<<"1\n";
}
return 0;
}