Pagini recente » Cod sursa (job #1867429) | Cod sursa (job #2193116) | Cod sursa (job #2728484) | Cod sursa (job #2803329) | Cod sursa (job #2533633)
#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;
}