Pagini recente » Cod sursa (job #2143299) | Cod sursa (job #2468426) | Cod sursa (job #566295) | Cod sursa (job #912969) | Cod sursa (job #773658)
Cod sursa(job #773658)
#include<cstdio>
#include<vector>
#define mod 666013
using namespace std;
vector <int> v[mod];
vector <int>::iterator it;
int tip,x,n,poz;
int main()
{
int i;
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
scanf("%d",&n);
for (i=1;i<=n;i++)
{
scanf("%d %d",&tip,&x);
poz=x%mod;
for (it=v[poz].begin();it!=v[poz].end()&& *it!=x;it++){}
if (tip==1)
if (it==v[poz].end())
v[poz].push_back(x);
if (tip==2)
if (it!=v[poz].end())
v[poz].erase(it);
if (tip==3)
if (it!=v[poz].end())
printf("1\n");
else
printf("0\n");
}
}