Pagini recente » Cod sursa (job #1898308) | Cod sursa (job #631781) | Cod sursa (job #2929583) | Cod sursa (job #1062132) | Cod sursa (job #2219156)
#include<fstream>
#include<vector>
#define prim 666013
using namespace std;
ifstream cin("hashuri.in");
ofstream cout("hashuri.out");
vector <long> Hash[prim];
int n;
bool cauta(long x){
int rest = x % prim;
for(int i = 0; i<Hash[rest].size(); ++i){
if(Hash[rest][i] == x) return 1;
}
return 0;
}
void push(long x){
if(cauta(x)==0){
Hash[x%prim].push_back(x);
}
}
void sterge(long x){
int rest = x%prim;
for(int i = 0; i<Hash[rest].size(); ++i){
if(Hash[rest][i]==x){
Hash[rest].erase(Hash[rest].begin() + i);
return;
}
}
}
int main()
{
cin>>n;
while(n--){
int op;
long x;
cin>>op;
cin>>x;
if(op==1){
push(x);
}
else if(op==2){
sterge(x);
}
else{
cout<<cauta(x)<<'\n';
}
}
return 0;
}