Pagini recente » Istoria paginii runda/concurs24 | Rating Voicu Alexandru (Alex1133) | Monitorul de evaluare | Rating Chelaru Radu (zechfron12) | Cod sursa (job #2282568)
#include <iostream>
#include <fstream>
#include <unordered_map>
int main()
{
std::ifstream in("hashuri.in");
std::ofstream out("hashuri.out");
int num_op;
in >> num_op;
std::unordered_map<long long, long long> Hash;
int operatie;
int index = 0;
int x;
while(in >> operatie){
switch(operatie){
case 1:
in >> x;
if(Hash.find(x) == Hash.end()){
Hash[x] = ++index;
}
break;
case 2:
in >> x;
Hash.erase(x);
break;
default:
in >> x;
if(Hash.find(x) != Hash.end()){
out << 1 << '\n';
}
else{
out << 0 << '\n' ;
}
break;
}
}
return 0;
}