Cod sursa(job #1494814)
Utilizator | Data | 1 octombrie 2015 21:25:51 | |
---|---|---|---|
Problema | Hashuri | Scor | 70 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.64 kb |
#include <fstream>
#include <unordered_map>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int main()
{
unordered_map<int, bool> myhash;
int N, op, x;
fin >> N;
for (int i = 1; i <= N; ++i) {
fin >> op >> x;
if (op == 1) {
if (myhash.find(x) == myhash.end()) {
myhash[x] = true;
}
} else if (op == 2) {
if (myhash.find(x) != myhash.end()) {
myhash.erase(x);
}
} else {
fout << (myhash.find(x) != myhash.end()) << '\n';
}
}
return 0;
}