Cod sursa(job #2734765)
| Utilizator | Data | 1 aprilie 2021 12:50:34 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 30 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.76 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
unordered_map<int, int> h;
int hashh, n;
int main()
{
int i, op, x, da;
fin >> n;
for(i = 1; i <= n; i++)
{
fin >> op;
fin >> x;
if(op == 1)
h[x] = 1;
if (op == 2)
{
da = 0;
for (auto& elem: h)
if(x == elem.first)
{
da = 1;
break;
}
if(da == 1)
h.erase(x);
}
if(op == 3)
{
if(h[x] == 1)
fout << "1\n";
else fout << "0\n";
}
}
return 0;
}
