Cod sursa(job #1022178)
Utilizator | Data | 4 noiembrie 2013 21:37:20 | |
---|---|---|---|
Problema | Hashuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.46 kb |
#include <fstream>
#include <unordered_map>
using namespace std;
int main() {
int N;
ifstream in("hashuri.in");
ofstream out("hashuri.out");
unordered_map<int, int> hash;
in>>N;
for (int i = 0; i < N; ++i) {
int c, x;
in>>c>>x;
switch (c) {
case 1: hash.insert(make_pair(x, x)); break;
case 2: hash.erase(x); break;
case 3: out << (hash.find(x) != hash.end()) << "\n"; break;
default: return -1;
}
}
in.close();
out.close();
return 0;
}