Pagini recente » Cod sursa (job #1478651) | Cod sursa (job #1600742) | Cod sursa (job #2897179) | Cod sursa (job #730781) | Cod sursa (job #951447)
Cod sursa(job #951447)
#include <cstdio>
#include <cassert>
#include <unordered_set>
using namespace std;
template<class IntType>
class IntHashCode {
public:
int operator()(const IntType &x) const {
return x % U;
}
private:
static const int U = 666013;
};
unordered_set<int, IntHashCode<int>> 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;
}