Cod sursa(job #1126273)
Utilizator | Data | 26 februarie 2014 22:19:36 | |
---|---|---|---|
Problema | Hashuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.48 kb |
#include <fstream>
#include <hash_set>
using namespace std;
hash_set<int, hash<int> > H;
int main(int argc, char *argv[]) {
long nr, x;
short op;
fstream in("hashuri.in", ios::in);
fstream out("hashuri.out", ios::out);
in >> nr;
for (int i = 0; i < nr; ++i) {
in >> op >> x;
switch(op) {
case 1:
H.insert(x);
case 2:
H.erase(x);
case 3:
out << (H.find(x) == H.end()) << "\n";
}
}
in.close();
out.close();
return 0;
}