Cod sursa(job #1476431)
| Utilizator | Data | 25 august 2015 09:57:50 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.56 kb |
#include <cstdio>
#include <unordered_set>
using namespace std;
int n;
unordered_set<int> H;
void solve() {
scanf("%d", &n);
H.reserve(n);
int type, x;
for (int i = 1; i <= n; i++) {
scanf("%d%d", &type, &x);
switch (type) {
case 1: {
H.insert(x);
break;
}
case 2: {
H.erase(x);
break;
}
case 3: {
printf("%d\n", (int)H.count(x));
break;
}
}
}
}
int main() {
freopen("hashuri.in", "r", stdin);
freopen("hashuri.out", "w", stdout);
solve();
return 0;
}
