Cod sursa(job #2123200)

Utilizator VarticeanNicolae Varticean Varticean Data 5 februarie 2018 21:40:39
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.49 kb
#include <bits/stdc++.h>
using namespace std;

map < int, int > mp;
int main()
{
     ifstream in("hashuri.in");
     ofstream out("hashuri.out");
     int key = 1, el, n,qw;
     in >> n ;
     for(int i=1; i<=n; i++)
     {
        in >>  qw >> el;

        if( qw == 1 && mp.find(el) == mp.end() ) mp[el] = key;
        if( qw == 2 ) mp.erase(el);
        if( qw == 3 ) if( mp.find(el) != mp.end() ) out <<1 << '\n'; else out << 0 << '\n';
        key ++;
     }

    return 0;
}