Cod sursa(job #2625027)
| Utilizator | Data | 5 iunie 2020 17:56:37 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.6 kb |
#include <iostream>
#include <fstream>
#include <unordered_map>
using namespace std;
unordered_map <int, int> m;
int main()
{
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int n, nr;
int i, tip, x;
f>>n;
for (i=1; i<=n; ++i)
{
f>>tip>>x;
if (tip == 1 && m.find(x) == m.end())
m[x] = ++nr;
if (tip == 2)
m.erase(x);
if (tip == 3)
{
if (m.find(x) != m.end())
cout<<1<<"\n";
else
cout<<0<<"\n";
}
}
return 0;
}
