Cod sursa(job #2744889)

Utilizator DenisTroacaDenis Troaca DenisTroaca Data 25 aprilie 2021 14:40:34
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.51 kb
#include <fstream>
#include <unordered_map>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int n,p;
string x;
int main(){
    unordered_map<string, int> hash_table;
    fin>>n;
    for(int i=0; i<n; i++){
        fin>>p>>x;
        if(p==1)
            hash_table[x]=1;
        if(p==2)
            hash_table.erase(x);
        if(p==3){
            if(hash_table[x]==1)
                fout<<1<<'\n';
            else
                fout<<0<<'\n';
        }
    }

}