Cod sursa(job #239838)

Utilizator bogdan2412Bogdan-Cristian Tataroiu bogdan2412 Data 5 ianuarie 2009 22:53:17
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.47 kb
#include <cstdio>
#include <ext/hash_set>

int N;
__gnu_cxx::hash_set<int> S;

int main()
{
    freopen("hashuri.in", "rt", stdin);
    freopen("hashuri.out", "wt", stdout);

    scanf("%d", &N);
    for (; N; N--)
    {
        int type, val;
        scanf("%d %d", &type, &val);

        if (type == 1)
            S.insert(val);
        if (type == 2)
            S.erase(val);
        if (type == 3)
            printf("%d\n", (S.find(val) != S.end()));
    }

    return 0;
}