Cod sursa(job #1180128)
Utilizator | Data | 29 aprilie 2014 23:13:25 | |
---|---|---|---|
Problema | Hashuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.53 kb |
#include <unordered_set>
#include <cstdio>
using namespace std;
const char *FIN = "hashuri.in", *FOU = "hashuri.out" ;
int N;
unordered_set <int> M;
int main (void) {
freopen (FIN, "r", stdin) ;
freopen (FOU, "w", stdout) ;
scanf ("%d ", &N), M.rehash (666013);
for (int i = 1, op, x; i <= N; ++i) {
scanf ("%d %d ", &op, &x) ;
if (op == 1 && M.count (x) == 0) M.insert (x);
else if (op == 2) M.erase (x);
else if (op == 3) printf ("%d\n", M.count (x) > 0) ;
}
}