Cod sursa(job #3132060)
| Utilizator | Data | 21 mai 2023 22:59:46 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.51 kb |
#include <iostream>
#include <set>
#include <fstream>
using namespace std;
int main() {
ifstream in("hashuri.in");
ofstream out("hashuri.out");
int n, op, x;
set<int> hash_set;
in >> n;
for (int i = 1; i <= n; i++) {
in >> op >> x;
if (op == 1)
hash_set.insert(x);
else if (op == 2)
hash_set.erase(x);
else if (op == 3)
out << (hash_set.find(x) != hash_set.end()) << '\n';
}
return 0;
}
