Cod sursa(job #2760846)

Utilizator VladCaloVlad Calomfirescu VladCalo Data 29 iunie 2021 11:57:12
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.7 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;
    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';
       // }


    }

    return 0;
}