Cod sursa(job #2757279)
| Utilizator | Data | 4 iunie 2021 20:58:28 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.45 kb |
#include <cstdio>
#include <unordered_set>
using namespace std;
int main()
{
freopen("hashuri.in", "r", stdin);
freopen("hashuri.out", "w", stdout);
int N, op, x;
unordered_set<int> hash;
scanf("%d", &N);
for (int i = 0; i < N; ++i) {
scanf("%d%d", &op, &x);
if (op == 1) {
hash.insert(x);
continue;
}
if (op == 2) {
hash.erase(x);
continue;
}
printf("%d\n", hash.count(x) == 1);
}
return 0;
}
