Pagini recente » Cod sursa (job #1387530) | Cod sursa (job #2035484) | Cod sursa (job #816897) | Cod sursa (job #2987843) | Cod sursa (job #2653476)
#include <fstream>
#include <unordered_set>
using namespace std;
unordered_set<int> hm;
int main()
{
ifstream in("hashuri.in");
ofstream out("hashuri.out");
int n, op, x;
in >> n;
for (int i = 1; i <= n; i++)
{
in >> op >> x;
if (op == 1)
{
if (hm.find(x) == hm.end())
{
hm.emplace(x);
}
}
else
{
if (op == 2)
{
if (hm.find(x) != hm.end())
{
hm.erase(hm.find(x));
}
}
else
{
if (hm.find(x) == hm.end())
{
out << 0 << '\n';
}
else
{
out << 1 << '\n';
}
}
}
}
return 0;
}