Cod sursa(job #3269227)

Utilizator stefanrotaruRotaru Stefan-Florin stefanrotaru Data 18 ianuarie 2025 14:08:51
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.58 kb
#include <fstream>
#include <unordered_map>

using namespace std;

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

int n, op, x;

unordered_map <int, bool> m;

int main()
{
    f >> n;

    while (n--) {
        f >> op >> x;

        if (op == 1) {
            if (m.find(x) == m.end()) {
                m[x] = 1;
            }
        }
        else if (op == 2) {
            if (m.find(x) != m.end()) {
                m.erase(x);
            }
        }
        else {
            g << (m.find(x) != m.end()) << '\n';
        }
    }

    return 0;
}