Cod sursa(job #2653475)
| Utilizator | Data | 28 septembrie 2020 10:48:58 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.93 kb |
#include <fstream>
#include <unordered_map>
using namespace std;
unordered_map<int, 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, 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;
}
