Cod sursa(job #2576184)

Utilizator betybety bety bety Data 6 martie 2020 17:46:13
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.55 kb
#include <fstream>
#include <unordered_map>
using namespace std;
ifstream cin("hashuri.in");
ofstream cout("hashuri.out");
unordered_map<int,bool> m;
int main()
{
    int n,op,x;
    cin>>n;
    for(int w=1;w<=n;++w)
    {
        cin>>op>>x;
        if(op==1) m[x]=1;
        else if(op==2)
        {
            auto it=m.find(x);
            if(it!=m.end()) m.erase(it);
        }
        else if(op==3){
            if(m.find(x)!=m.end())
                cout<<1<<'\n';
            else cout<<0<<'\n';
        }
    }
    return 0;
}