Pagini recente » Istoria paginii utilizator/euunu | Cod sursa (job #2776876)
#include<bits/stdc++.h>
using namespace std;
ifstream A("hashuri.in");
ofstream B("hashuri.out");
#define M 666013
int n,o,x;
vector<int> G[M];
inline vector<int>::iterator F(int x)
{
int l=x%M;
vector<int>::iterator i;
for(i=G[l].begin();i!=G[l].end();++i)
if(*i==x)
return i;
return G[l].end();
}
inline void I(int x)
{
int l=x%M;
if(F(x)==G[l].end())
G[l].push_back(x);
}
inline void E(int x)
{
int l=x%M;
vector<int>::iterator i=F(x);
if(i!=G[l].end())
G[l].erase(i);
}
int main()
{
for(A>>n;n;--n) {
A>>o>>x;
if(o==1)
I(x);
else if(o==2)
E(x);
else
B<<(F(x)!=G[x%M].end())<<"\n";
}
return 0;
}