Pagini recente » Cod sursa (job #2709788) | Cod sursa (job #2565069) | Cod sursa (job #1403364) | Cod sursa (job #2970084) | Cod sursa (job #1124803)
#include <algorithm>
#include <fstream>
#include <iostream>
#include <unordered_set>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
struct MyHasher {
bool operator()(int val) const {
return (val & ((1 << 20) - 1));
}
};
int main() {
unordered_set<int, MyHasher> h;
int m;
fin >> m;
for (int i = 1, op, val; i <= m; i += 1) {
fin >> op >> val;
if (op == 1) {
h.insert(val);
} else if (op == 2) {
h.erase(val);
} else {
fout << h.count(val) << '\n';
}
}
return 0;
}