Cod sursa(job #2563540)

Utilizator YetoAdrian Tonica Yeto Data 1 martie 2020 12:23:39
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.56 kb
#include <fstream>
#include <map>
using namespace std;
int n, test, x, i;
ifstream fin ("hashuri.in");
ofstream fout ("hashuri.out");
map <int,int> h;

int main () {
    fin>>n;
    for (i=1;i<=n;i++) {
        fin>>test>>x;
        if (test==1) {
            if (h.find(x)==h.end())
                h[x]=1;
        } else if (test==2) {
            h.erase(x);
        } else {
            if(h.find(x)!=h.end()) {
                fout<<1;
            } else
                fout<<0;
            fout<<"\n";
        }
    }

    return 0;
}