Pagini recente » Cod sursa (job #1216203) | Cod sursa (job #1073601) | Cod sursa (job #2731088) | Cod sursa (job #1692570) | Cod sursa (job #960290)
Cod sursa(job #960290)
#include <iostream>
#include <cstdio>
#include <vector>
#define h 123457
using namespace std;
int o,n,x,y;
vector <int> v[h];
int main()
{
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
vector <int>::iterator it;
scanf("%d",&n);
for(;n;n--)
{
scanf("%d%d",&o,&x);
y=x%h;
for(it=v[y].begin();it!=v[y].end();it++)
if(*it==x) break;
if(o==1)
{
if(it==v[y].end())
v[y].push_back(x);
continue;
}
if(o==2)
{
if(it!=v[y].end())
{
*it=v[y].back();
v[y].pop_back();
}
continue;
}
if(it==v[y].end())
printf("0\n");
else printf("1\n");
}
return 0;
}