Cod sursa(job #2949801)

Utilizator CobzaruAntonioCobzaru Paul-Antonio CobzaruAntonio Data 1 decembrie 2022 18:51:13
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.57 kb
#include <fstream>
#include <set>
using namespace std;
ifstream fin ("hashuri.in");
ofstream fout ("hashuri.out");
int n,x,t,i;
set<int> s;
int main()
{
    ios::sync_with_stdio(false);
    fin.tie(0);
    fout.tie(0);
    fin >> n;
    for (i=1;i<=n;i++)
    {
        fin >> t >> x;
        if (t == 1)
            s.insert(x);
        else if (t == 2)
            s.erase(x);
        else
        {
            if (s.count(x) == 0)
                fout << 0 << '\n';
            else
                fout << 1 << '\n';
        }
    }
    return 0;
}