Cod sursa(job #1886686)

Utilizator alexionpopescuPopescu Ion Alexandru alexionpopescu Data 21 februarie 2017 08:04:37
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.5 kb
#include <bits/stdc++.h>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
map<int,int> m;
int n,i,x,t,nr;
int main(){
    fin>>n;
    for(i=1;i<=n;i++){
        fin>>t>>x;
        if(t==1&&m.find(x)==m.end())
            m[x]=++nr;
        if(t==2)
            m.erase(x);
        if(t==3)
            if(m.find(x)!=m.end())
                fout<<1<<'\n';
            else
                fout<<0<<'\n';
    }
    fin.close();
    fout.close();
    return 0;
}