Cod sursa(job #1402769)

Utilizator Alexghita96Ghita Alexandru Alexghita96 Data 26 martie 2015 20:15:30
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.47 kb
#include <cstdio>
#include <map>

using namespace std;

int N, op, x, cnt;
map <int, int> M;

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

    scanf("%d", &N);

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

    return 0;
}