Cod sursa(job #1692524)

Utilizator Vlad_317Vlad Panait Vlad_317 Data 21 aprilie 2016 01:04:20
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.53 kb
#include <stdio.h>
#include <map>

using namespace std;

int n, nr;
map <int, int> M;

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

    int i, tip, x;

    scanf("%d ", &n);

    for (i = 1; i <= n; i++)
    {
        scanf("%d %d ", &tip, &x);

        if (tip == 1 && M.find(x) == M.end())
            M[x] = ++nr;
        if (tip == 2)
            M.erase(x);
        if (tip == 3)
            printf("%d\n", M.find(x) != M.end());
    }

    return 0;
}