Cod sursa(job #2622835)
| Utilizator | Data | 1 iunie 2020 22:16:35 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.72 kb |
#include<bits/stdc++.h>
#include <fstream>
#include <unordered_map>
using namespace std;
ifstream in("hashuri.in");
ofstream out ("hashuri.out");
unordered_map <int, int> HASH;
unordered_map <int, int>::iterator b;
int n,op,x;
int main()
{
int n;
in>>n;
for (int i=1;i<=n;++i)
{
in>>op>>x;
if (op==1)
HASH.insert(make_pair(x,1));
if (op==2)
{
b=HASH.find(x);
if (b!=HASH.end());
HASH.erase(x);
}
if (op==3)
{
b=HASH.find(x);
if (b!=HASH.end())
out<<1<<'\n';
else
out<<0<<'\n';
}
}
return 0;
}
