Pagini recente » Cod sursa (job #2405296) | Cod sursa (job #1556378) | Cod sursa (job #1370561) | Cod sursa (job #1468103) | Cod sursa (job #2541817)
#include <bits/stdc++.h>
using namespace std;
#define p 700027
ifstream in("hashuri.in");
ofstream out("hashuri.out");
vector < int > h[p];
vector<int>::iterator tip3 (int x)
{
int k=x%p;
for (vector<int>::iterator it = h[k].begin() ; it != h[k].end(); ++it)
if(*it == x)return it;
return h[k].end();
}
void tip1(int x)
{
int k=x%p;
if(tip3(x)==h[k].end())h[k].push_back(x);
}
void tip2(int x)
{
int k=x%p;
vector<int>::iterator it = tip3(x);
if(tip3(x)!=h[k].end())h[k].erase(it);
}
int main()
{
long long n;
in>>n;
for(int x,y,i=1;i<=n;i++)
{
in>>x;
if(x==1){in>>y;tip1(y);}
if(x==2){in>>y;tip2(y);}
if(x==3){in>>y;out<<(tip3(y)!=h[y%p].end())<<'\n';}
}
in.close();
out.close();
return 0;
}