Cod sursa(job #362813)
| Utilizator | Data | 11 noiembrie 2009 06:59:54 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.5 kb |
#include <cstdio>
#include <tr1/unordered_set>
using namespace std;
typedef std::tr1::unordered_set<int> myHash;
int main() {
freopen("hashuri.in", "r", stdin);
freopen("hashuri.out", "w", stdout);
int n;
scanf("%d", &n);
myHash M;
while (n--) {
int op, x;
scanf("%d %d", &op, &x);
if (op == 1) {
M.insert(x);
continue;
}
if (op == 2) {
M.erase(x);
continue;
}
if (M.find(x)!=M.end()) printf("1\n");
else printf("0\n");
}
return 0;
}
