Pagini recente » Cod sursa (job #588096) | Cod sursa (job #896942) | Cod sursa (job #657400) | Cod sursa (job #2020761) | Cod sursa (job #951441)
Cod sursa(job #951441)
#include <cstdio>
#include <cassert>
#include <unordered_set>
using namespace std;
class HashFunction {
public:
size_t operator()(const int &x) const {
return x % U;
}
private:
static const int U = 666013;
};
unordered_set<int, HashFunction> Hash;
int main() {
assert(freopen("hashuri.in", "r", stdin));
assert(freopen("hashuri.out", "w", stdout));
int N; assert(scanf("%d", &N) == 1);
for (; N > 0; --N) {
int type, x; assert(scanf("%d %d", &type, &x) == 2);
if (type == 1)
Hash.insert(x);
if (type == 2)
Hash.erase(x);
if (type == 3)
printf("%d\n", Hash.find(x) != Hash.end());
}
return 0;
}