Pagini recente » Cod sursa (job #742340) | Cod sursa (job #2052073) | Cod sursa (job #1411318) | Cod sursa (job #419034) | Cod sursa (job #2223937)
#include <bits/stdc++.h>
using namespace std;
set<int> hashh [1000000];
void insertt (int x) {
int modulo = x % 1000000;
hashh[modulo].insert(x);
}
void erasee (int x) {
int modulo = x % 1000000;
hashh[modulo].erase(x);
}
bool isIn (int x) {
int modulo = x % 1000000;
return hashh[modulo].find(x) != hashh[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) {
insertt(x);
}
if (tip == 2) {
erasee(x);
}
if (tip == 3) {
if (isIn(x)) {
putchar('1');
} else {
putchar('0');
}
putchar('\n');
}
}
return 0;
}