Cod sursa(job #1774485)
| Utilizator | Data | 9 octombrie 2016 00:07:38 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include <iostream>
#include <fstream>
#include <map>
using namespace std;
int main() {
ifstream cin("hashuri.in");
ofstream cout("hashuri.out");
map<unsigned int, bool> h;
unsigned n, op, x;
cin>>n;
for (int i = 0; i < n; i++) {
cin>>op>>x;
if (op == 1) {
h[x] = true;
} else if (op == 2) {
if (h.find(x) != h.end()) {
h.erase(h.find(x));
}
} else {
cout<<(h.find(x)!=h.end())<<"\n";
}
}
}
