Cod sursa(job #1235882)

Utilizator cernat.catallinFMI Cernat Catalin Stefan cernat.catallin Data 30 septembrie 2014 20:42:38
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.54 kb
#include <stdio.h>
#include <unordered_set>

typedef std::unordered_set<int> iset;
typedef iset::iterator iset_itr;

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

    int n, op, nr;
    iset hash;
    iset_itr it;
    
    scanf("%d", &n);
    for (int i = 0; i < n; ++i){
        scanf("%d %d", &op, &nr);
        if (op == 1) hash.insert(nr);
        else if (op == 2) hash.erase(nr);
        else if (hash.find(nr) == hash.end())
            printf("0\n");
        else
            printf("1\n");
    }
}