Cod sursa(job #1337706)

Utilizator nacrocRadu C nacroc Data 9 februarie 2015 13:25:29
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.49 kb
#include <stdio.h>
#include <map>

using namespace std;

map <int, int> m;

int main(){
    freopen("hashuri.in","r",stdin);
    freopen("hashuri.out","w",stdout);
    int n, op, x, nr = 0;
    scanf("%d", &n);
    while(n--){
        scanf("%d %d", &op, &x);
        if(op == 1 && m.find(x) == m.end())
            m.insert(make_pair(x, ++nr));
        if(op == 2)
            m.erase(x);
        if(op == 3)
            printf("%d\n",m.find(x) != m.end());
    }
    return 0;
}