Pagini recente » Cod sursa (job #2392590) | Cod sursa (job #963951) | Cod sursa (job #2956788) | Cod sursa (job #1061895) | Cod sursa (job #3131298)
#include <iostream>
#include <unordered_set>
#include <fstream>
using namespace std;
int main() {
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int n;
fin >> n;
unordered_set<int> hashSet;
for (int i = 0; i < n; i++) {
int operatie, x;
fin >> operatie >> x;
if (operatie == 1) {
hashSet.insert(x);
} else if (operatie == 2) {
hashSet.erase(x);
} else if (operatie == 3) {
if (hashSet.find(x) != hashSet.end()) {
fout << "1\n";
} else {
fout << "0\n";
}
}
}
fin.close();
fout.close();
return 0;
}