Pagini recente » Cod sursa (job #195138) | Istoria paginii runda/urmasiiluidoru | Cod sursa (job #2238902) | Rating Sachelarie Raluca (lalainfo) | Cod sursa (job #2282567)
#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 << ' ';
}
else{
out << 0 << ' ' ;
}
break;
}
}
return 0;
}