Cod sursa(job #1706480)

Utilizator AcuasPopescu Nicolae-Aurelian Acuas Data 22 mai 2016 17:55:10
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.49 kb
#include <fstream>
#include <map>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int n,x,y;
map< int,int > h;
int main(){
    f>>n;
    int i;
    for(i=1;i<=n;++i){
        f>>x>>y;
        if(x==1)
            h[y]=1;
        else if(x==2){
            if(h[y]==1)
                h.erase(y);
        }
        else{
            if(h[y]==1)
                g<<1<<'\n';
            else
                g<<0<<'\n';
        }
    }
    return 0;
}