Pagini recente » Cod sursa (job #2902147) | Cod sursa (job #2396025) | Cod sursa (job #674477) | Cod sursa (job #2453839) | Cod sursa (job #2749944)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
class MyUnorderedMap {
vector<vector<int>> umap{(666013)};
public:
void insert(int x){
int sertar=x%666013;
for(int i=0;i<umap[sertar].size();i++){
if(x==umap[sertar][i]){
return;
}
}
umap[sertar].push_back(x);
};
void erase(int x){
int sertar=x%666013;
for(int i=0;i<umap[sertar].size();i++){
if(x==umap[sertar][i]){
umap[sertar].erase(umap[sertar].begin()+i);
}
}
};
bool search(int x){
int sertar=x%666013;
for(int i=0;i<umap[sertar].size();i++){
if(x==umap[sertar][i]){
return true;
}
}
return false;
};
};
int main(){
int n,i,x,y;
MyUnorderedMap v;
fin>>n;
for(i=1;i<=n;i++){
fin>>x>>y;
if(x==1){
v.insert(y);
}else{
if(x==2){
v.erase(y);
}else{
if(x==3){
cout<<v.search(y);
}
}
}
}
return 0;
}