Cod sursa(job #2928078)

Utilizator Iordache_CezarIordache Cezar Iordache_Cezar Data 22 octombrie 2022 09:31:03
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.59 kb
#include <bits/stdc++.h>

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

int n, op, x;
map <int, bool> M;

int main()
{
    fin >> n;
    for (int i = 1; i <= n; i++)
    {
        fin >> op >> x;
        if (M.find(x) != M.end())
        {
            if (op == 2)
                M.erase(x);
            else if (op == 3)
                fout << 1 << '\n';
        }
        else
        {
            if (op == 1)
                M[x] = 1;
            else if (op == 3)
                fout << 0 << '\n';
        }
    }
    return 0;
}