Cod sursa(job #1988759)

Utilizator sichetpaulSichet Paul sichetpaul Data 4 iunie 2017 16:43:59
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.44 kb
#include <fstream>
#include <map>
using namespace std;
map <int,int> v;
int main()
{  int tip,x,i,n;
    ifstream f("hashuri.in");
    ofstream g("hashuri.out");
    f>>n;
    for (i=1;i<=n;++i) {
        f>>tip>>x;
        if (tip==1 && (v.find(x)==v.end())) ++v[x];
        if (tip==2) v.erase(x);
        if (tip==3) {
            if (v.find(x)==v.end()) g<<'0'<<'\n';
            else g<<'1'<<'\n';
        }
    }
    return 0;
}