Pagini recente » Cod sursa (job #1179402) | Cod sursa (job #2812442) | Cod sursa (job #2248004) | Cod sursa (job #20581) | Cod sursa (job #3132066)
#include <iostream>
#include <fstream>
#include <unordered_set>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int main() {
int n;
fin >> n;
unordered_set<int> hashSet;
for (int i = 0; i < n; i++) {
int op, x;
fin >> op >> x;
if (op == 1) {
hashSet.insert(x);
} else if (op == 2) {
hashSet.erase(x);
} else if (op == 3) {
int result = (hashSet.count(x) > 0) ? 1 : 0;
fout << result << '\n';
}
}
fin.close();
fout.close();
return 0;
}