Cod sursa(job #2772699)
| Utilizator | Data | 2 septembrie 2021 13:03:29 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.7 kb |
#include <fstream>
#include <unordered_map>
using namespace std;
ifstream in("hashuri.in");
ofstream out("hashuri.out");
unordered_map<int, bool> Hash;
int n, x, y;
int main() {
ios_base::sync_with_stdio(false);
in.tie(NULL), out.tie(NULL);
in >> n;
for(int i = 1; i <= n; i++) {
in >> x >> y;
if(x == 1) {
Hash[y] = true;
} else if(x == 2) {
Hash.erase(y);
} else if(x == 3) {
out << (Hash.find(y) != Hash.end()) << "\n";
}
}
in.close();
out.close();
return 0;
}
