Cod sursa(job #3138958)

Utilizator Mihai_PopescuMihai Popescu Mihai_Popescu Data 23 iunie 2023 16:09:35
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.47 kb
#include <fstream>
#include <unordered_set>
using namespace std;

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

unordered_set<int> S;

int main()
{
    int n;
    fin >> n;

    for (int i = 1; i <= n; ++i)
    {
        int op, x;
        fin >> op >> x;
        if (op == 1)
            S.insert(x);
        else if (op == 2)
            S.erase(x);
        else
            fout << (S.find(x) != S.end()) << '\n';
    }
    return 0;
}