Pagini recente » Cod sursa (job #1885708) | Monitorul de evaluare | Cod sursa (job #187861) | Cod sursa (job #357941) | Cod sursa (job #811397)
Cod sursa(job #811397)
#include <set>
#include <cstdio>
#include <vector>
#include <hash_set>
using namespace std;
using namespace __gnu_cxx;
inline int next_int() {
int d;
scanf("%d", &d);
return d;
}
hash_set<int> s;
hash_set<int>::iterator it;
int main() {
freopen("hashuri.in", "r", stdin);
freopen("hashuri.out", "w", stdout);
int n = next_int();
for (int i = 0; i < n; i++) {
int t = next_int();
int x = next_int();
if (t == 1) {
s.insert(x);
}
if (t == 2) {
it = s.find(x);
if (it != s.end()) {
s.erase(it);
}
}
if (t == 3) {
printf("%d\n", int(s.count(x)));
}
}
return 0;
}