Pagini recente » Cod sursa (job #2463163) | Cod sursa (job #2464198) | Cod sursa (job #3145520) | Cod sursa (job #450097) | Cod sursa (job #2780899)
#include <bits/stdc++.h>
using namespace std;
int ind;
const int Mod=666013;
vector <int> h[Mod];
vector <int> :: iterator it;
vector <int> :: iterator Find(int x)
{
for(it=h[ind].begin(); it!=h[ind].end(); ++it)
if(*it==x)return it;
return it;
}
void adauga(int x)
{
if(it==h[ind].end())h[ind].push_back(x);
}
void sterge(int x)
{
if(it!=h[ind].end())h[ind].erase(it);
}
void scrie(int x)
{
if(it==h[ind].end())cout<<0;
else cout<<1;
cout<<'\n';
}
int main()
{
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
cin.sync_with_stdio(false);
cin.tie(0);
int q;
cin>>q;
for(int i=1; i<=q; ++i)
{
int t,x;
cin>>t>>x;
ind=x%Mod;
Find(x);
if(t==1)
{
adauga(x);
}
else if(t==2)
{
sterge(x);
}
else if(t==3)
{
scrie(x);
}
}
return 0;
}