Pagini recente » Cod sursa (job #2584302) | Cod sursa (job #33516) | Cod sursa (job #643014) | Cod sursa (job #1920381) | Cod sursa (job #2107539)
#include <iostream>
#include <unordered_map>
using namespace std;
unordered_map <int, int> a;
int n, i, op, x;
const int Lim = 10000000;
int u = Lim - 1;
char s[Lim];
void Next () {
if (++u == Lim)
std::fread(s, 1, Lim, stdin), u = 0;
}
void Get (int &x) {
for (; s[u] < '0' || s[u] > '9'; Next());
for (x = 0; s[u] >= '0' && s[u] <= '9'; Next())
x = x * 10 + s[u] - '0';
}
int main() {
freopen("hashuri.in", "r", stdin);
freopen("hashuri.out", "w", stdout);
Get(n);
for (i = 1; i <= n; ++i) {
Get(op); Get(x);
if (op == 1) ++a[x];
else if (op == 2) {
if (a[x])
--a[x];
}
else if (a[x]) cout << 1 << '\n';
else cout << 0 << '\n';
}
}