Cod sursa(job #627765)
| Utilizator | Data | 30 octombrie 2011 17:42:17 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.41 kb |
#include<fstream>
#include<iostream>
#include<tr1/unordered_map>
using namespace std;
using namespace tr1;
unordered_map <int,int> h;
int main() {
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int n;
f >> n;
int t, x;
for (int i = 1; i <= n; i++) {
f >> t >> x;
if (t == 1) {
h[x]++;
} else if (t == 2) {
h.erase(x);
} else {
g << (h.find(x) != h.end()) << '\n';
}
}
return 0;
}
