Cod sursa(job #2761448)

Utilizator VladCaloVlad Calomfirescu VladCalo Data 2 iulie 2021 10:24:53
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.76 kb


#include <iostream>
#include <fstream>
#include <unordered_set>

using namespace std;



int main() {

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

    fin.sync_with_stdio(false);  //aparent functioneaza la optimizare,                                  fara 70p
    fin.tie(0);

    unordered_set<int> hashh;

    int n,op,a;
    fin>>n; // numar op
    for (int i=0; i<n; i++)
    {
        fin>>op>>a;
        if(op==1)
        {
            hashh.insert(a);
            continue;
        }
      if (op==2)
        {
            hashh.erase(a);
            continue;
        }
       // else
        //{
            fout<< (hashh.find(a) != hashh.end())<<'\n';// daca elem a exista afisam 1, in caz contrar 0
       // }


    }

    return 0;
}