Cod sursa(job #2743591)

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

using namespace std;

unordered_map<int, bool> m;

ifstream f("hashuri.in");
ofstream g("hashuri.out");

int main()
{
    int n, com, x;
    f>>n;
    for(short i=0; i<n; ++i)
    {
        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;
}