Cod sursa(job #2533631)
| Utilizator | Data | 29 ianuarie 2020 15:13:27 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include <bits/stdc++.h>
const int mod = 820489;
struct ModuloHasher {
int operator()(const int &x) const { return (x%mod + mod)%mod; }
}; 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;
}
