Cod sursa(job #2743582)

Utilizator wildcolaSTEFAN PLACINTESCU wildcola Data 23 aprilie 2021 12:02:40
Problema Hashuri Scor 30
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.6 kb
#include <bits/stdc++.h>

using namespace std;

unordered_map<int, int> m;

int main()
{
    ifstream f("hashuri.in");
    ofstream g("hashuri.out");
    int n;
    f>>n;
    for(short i=0; i<n; ++i)
    {
        int com, x;
        f>>com>>x;
        if(com==1)
        {
            if(m.find(x) == m.end())
                m[x]=1;
        }

        else
            if(com == 2)
                m.erase(x);
            else
                if(m.find(x) == m.end())
                    g<<0<<"\n";
                else
                    g<<1<<"\n";

    }
    return 0;
}