Pagini recente » Cod sursa (job #2576131) | Cod sursa (job #1972120) | Cod sursa (job #2373606) | Cod sursa (job #2662017) | Cod sursa (job #1972245)
#include <iostream>
#include <fstream>
#include <vector>
#define K 262583
using namespace std;
ifstream in("hashuri.in");
ofstream out("hashuri.out");
vector<int> h[K];
bool _find_(int x){
int key=x%K;
for(int i=0; i<h[key].size(); i++){
if(h[key][i]==x)return true;
}
return false;
}
void add(int x){
if(!_find_(x))h[x%K].push_back(x);
}
void del(int x){
int key=x%K;
for(int i=0; i<h[key].size(); i++){
if(h[key][i]==x){
h[key].erase(h[key].begin()+i);
return;
}
}
}
int main(){
int n, x, y;
in>>n;
for(int i=1; i<=n; i++){
in>>x>>y;
if(x==1)add(y);
else if(x==2)del(y);
else out<<_find_(y)<<"\n";
}
return 0;
}