Cod sursa(job #1154341)

Utilizator TimitocArdelean Andrei Timotei Timitoc Data 26 martie 2014 09:34:56
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.61 kb
#include <iostream>
#include <cstdio>
#include <hash_map>

using namespace std;
using namespace __gnu_cxx;

hash_map<int, int> m;
int n, op, x;

int main()
{
    freopen("hashuri.in", "r", stdin);
    freopen("hashuri.out", "w", stdout);

    scanf("%d", &n);
    for(int i=0; i<n; i++){
        scanf("%d %d", &op, &x);
        if(op == 1){
            if(m.find(x)==m.end())
                m[x] = 1;
        }
        else if(op == 2){
            if(m.find(x)!=m.end())
                m.erase(x);
        }
        else
            printf("%d\n", m.find(x)!=m.end());
    }
    return 0;
}