Cod sursa(job #2549271)

Utilizator Bogdy_PPrunescu Bogdan Bogdy_P Data 17 februarie 2020 15:18:59
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.56 kb
#include <bits/stdc++.h>

using namespace std;

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

set <int> S;

int n, q, x, y;

int main()
{
    in >> n;
    while(n--)
    {
        in >> q;
        if(q == 1)
        {
            in >> x;
            S.insert(x);
        }
        else if(q == 3)
        {
            in >> x;
            if(S.find(x) != S.end()) out << 1 << '\n';
            else out << 0 << '\n';
        }
        else
        {
            in >> x;
            S.erase(x);
        }
    }
    return 0;
}