Pagini recente » Cod sursa (job #2192065) | Cod sursa (job #2268245) | Cod sursa (job #3326925) | Cod sursa (job #1268970) | Cod sursa (job #3339067)
#include <bits/stdc++.h>
using namespace std;
unordered_map<int, bool> h;
void add(int x) {
h[x] = true;
}
void remove(int x) {
auto it = h.find(x);
if(it != h.end())
h.erase(it);
}
void query(int x) {
auto it = h.find(x);
if(it != h.end())
cout << "1\n";
else
cout << "0\n";
}
signed main() {
cin.tie(nullptr)->sync_with_stdio(false);
#ifndef LOCAL
freopen("hashuri.in", "r", stdin);
freopen("hashuri.out", "w", stdout);
#endif
int n; cin >> n;
for(int i = 0; i < n; ++i) {
int op, x; cin >> op >> x;
if(op == 1)
add(x);
else if(op == 2)
remove(x);
else
query(x);
}
return 0;
}