Pagini recente » Cod sursa (job #2885235) | Monitorul de evaluare | Cod sursa (job #2775944) | Cod sursa (job #883545) | Cod sursa (job #803260)
Cod sursa(job #803260)
#include <cstdio>
#include <vector>
#define H 100009
using namespace std;
vector<int> V[H];
int m,c,x,h;
int main()
{
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
vector<int>::iterator it;
scanf("%d",&m);
for(;m;m--)
{
scanf("%d%d",&c,&x);
h=x%H;
for(it=V[h].begin();it!=V[h].end();it++)
if(*it==x)break;
if(c==1)
{
if(it==V[h].end())
V[h].push_back(x);
continue;
}
if(c==2)
{
if(it!=V[h].end())
{
*it = V[h].back();
V[h].pop_back();
}
continue;
}
if(it==V[h].end())printf("0\n");
else printf("1\n");
}
return 0;
}