Cod sursa(job #1927518)
| Utilizator | Data | 15 martie 2017 10:19:54 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.46 kb |
#include <fstream>
#include <unordered_map>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int n;
unordered_map<int, bool> hm;
int main() {
fin >> n;
for (int i = 1; i <= n; ++i) {
int t, x;
fin >> t >> x;
if (t == 1) {
hm[x] = true;
} else if (t == 2) {
hm.erase(x);
} else {
if (hm[x]) {
fout << 1 << '\n';
} else {
fout << 0 << '\n';
}
}
}
return 0;
}
