Cod sursa(job #2760824)

Utilizator VladCaloVlad Calomfirescu VladCalo Data 29 iunie 2021 11:31:02
Problema Hashuri Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.78 kb
//
//  main.cpp
//  hashuri
//
//  Created by Vlad Calomfirescu on 29.06.2021.
//

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

using namespace std;

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

unordered_set<int> hashh;

int main() {
   
    
    int n,op,x;
    fin>>n;
    for (int i=0; i<n; i++)
    {
        fin>>op;
        switch(op){
            case 1:
                fin>>x;
                hashh.insert(x);
                continue;
            case 2:
                fin>>x;
                hashh.erase(x);
                continue;
            case 3:
                fin>>x;
                if(hashh.find(x) != hashh.end())
                    cout<<1<<endl;
                else
                    cout<<0<<endl;
        }
    }
    
    return 0;
}