Cod sursa(job #2550389)

Utilizator StasBrega Stanislav Stas Data 18 februarie 2020 19:33:49
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.54 kb
#include <bits/stdc++.h>

using namespace std;

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

unordered_map <int,int> a;
int n;

int main()
{

    fin >> n;

    for(;n;n--)
    {
        int x,y;
        fin >> x >> y;
        auto it=a.find(y);
        bool ok=(it!=a.end());
        if(x==1 and !ok)
            a[y]=y;
        if(x==2 and ok)
            a.erase(it);
        if(x==3 and ok)
            fout << 1 << "\n";
        if(x==3 and !ok)
            fout << 0 << "\n";
    }

    return 0;

}