Pagini recente » Cod sursa (job #2744954) | Cod sursa (job #1547000) | Cod sursa (job #865315) | Cod sursa (job #2677850) | Cod sursa (job #1494817)
#include <fstream>
#include <unordered_map>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int main()
{
unordered_map<int, bool> myhash;
int N, op, x;
fin >> N;
for (int i = 1; i <= N; ++i) {
fin >> op >> x;
if (op == 1) {
if (myhash.find(x) == myhash.end()) {
myhash[x] = true;
}
} else if (op == 2) {
unordered_map<int, bool>::iterator it = myhash.find(x);
if (it != myhash.end()) {
myhash.erase(it);
}
} else {
fout << (myhash.find(x) != myhash.end()) << '\n';
}
}
return 0;
}