Pagini recente » Cod sursa (job #2611979) | Cod sursa (job #179159) | Cod sursa (job #1145190) | Cod sursa (job #2562026) | Cod sursa (job #2223934)
#include <bits/stdc++.h>
using namespace std;
set<int> hash [1000000];
void insert (int x) {
int modulo = x % 1000000;
hash[modulo].insert(x);
}
void erase (int x) {
int modulo = x % 1000000;
hash[modulo].erase(x);
}
bool isIn (int x) {
int modulo = x % 1000000;
return hash[modulo].find(x) != hash[modulo].end();
}
int main() {
ifstream fin ("hashuri.in");
freopen("hashuri.out", "w", stdout);
int n;
fin >> n;
for (int i = 1; i <= n; ++i) {
int tip, x;
fin >> tip >> x;
if (tip == 1) {
insert(x);
}
if (tip == 2) {
erase(x);
}
if (tip == 3) {
if (isIn(x)) {
putchar('1');
} else {
putchar('0');
}
putchar('\n');
}
}
return 0;
}