Cod sursa(job #2628084)

Utilizator cpopescu1Popescu Cristian cpopescu1 Data 14 iunie 2020 12:57:48
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.5 kb
#include <bits/stdc++.h>
using namespace std;

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


int main()
{
    int n;
    int op,x;
    unordered_set<int> hT;
    fin>>n;
    for(int i=1;i<=n;i++)
    {
        fin>>op>>x;
        if(op==1 && hT.find(x)==hT.end()) hT.insert(x);
        else if(op==2 && hT.find(x)!=hT.end()) hT.erase(x);
        else if(op==3){
            if(hT.find(x)!=hT.end()) fout<<"1\n";
            else fout<<"0\n";
        }
    }
    return 0;
}