Pagini recente » Cod sursa (job #1335547) | Cod sursa (job #1144251) | Cod sursa (job #2048219) | Cod sursa (job #2389700) | Cod sursa (job #2533632)
#include <bits/stdc++.h>
const int mod = 820489;
const double A = 0.618034;
struct ModuloHasher {
int operator()(const int &x) const { return mod*(A*x-int(A*x)); }
}; std::unordered_set <int, ModuloHasher> set;
std::ifstream input ("hashuri.in");
std::ofstream output("hashuri.out");
int main()
{
int Q; input >> Q;
int op, x;
while (Q--) {
input >> op >> x;
if (op == 1) set.insert(x);
else if (op == 2) set.erase(x);
else if (op == 3) output << (set.find(x) != set.end()) << '\n';
}
return 0;
}