Cod sursa(job #2868767)

Utilizator LucaMuresanMuresan Luca Valentin LucaMuresan Data 11 martie 2022 10:18:43
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.6 kb
#include <bits/stdc++.h>

using namespace std;

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

unordered_map<int, bool>m;

int main()
{
    int q;
    in >> q;
    while (q--){
        int oper, x;
        in >> oper >> x;
        if (oper == 1 && m.find(x) == m.end())
            m[x]=1  ;
        else if (oper == 2 && m.find(x) != m.end())
            m.erase(x);
        else if (oper == 3)
        {
            if (m.find(x) == m.end())
                out << 0;
            else
                out << 1;
            out << '\n';
        }
    }
    return 0;
}