Cod sursa(job #2741240)

Utilizator AlexandraBoghiuAlexandra Boghiu AlexandraBoghiu Data 15 aprilie 2021 19:07:57
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.55 kb
#include <bits/stdc++.h>
using namespace std;
ifstream F ("hashuri.in");
ofstream G ("hashuri.out");
unordered_set <int> heap;
int main()
{
    int n, op, x;
    F>>n;
    for(int i = 0; i < n; i++)
    {
        F>>op>>x;
        if(op == 1)
        {
            heap.insert(x);
        }
        else if(op == 2)
        {

            if(heap.count(x))
                heap.erase(x);
        }
        else if (op == 3)
            if(heap.count(x))
                G<<1<<'\n';
            else G<<0<<'\n';

    }
    return 0;
}