Pagini recente » Cod sursa (job #2675993) | Cod sursa (job #1223703) | Clasament preONI 2006, Clasa a IX-a si gimnaziu | Cod sursa (job #228200) | Cod sursa (job #767222)
Cod sursa(job #767222)
#include<cstdio>
#include<vector>
using namespace std;
vector <int> a[666014];
vector <int> ::iterator it;
int n,i,op,x,y;
int main()
{
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
scanf("%d",&n);
for(i = 1;i <= n;i ++)
{
scanf("%d %d",&op,&x);
y=x % 666013;
if(op == 1)
{
for(it = a[y].begin();it != a[y].end(); it ++)
if(*it == x )
break;
if(it == a[y].end())
a[y].push_back(x);
}
else
if(op == 2)
{
for(it = a[y].begin();it != a[y].end(); it ++)
if(*it == x )
break;
if(it != a[y].end())
a[y].erase(it);
}
else
{
for(it = a[y].begin();it != a[y].end(); it ++)
if(*it == x )
break;
if(it != a[y].end())
printf("1\n");
else
printf("0\n");
}
}
return 0;
}