Cod sursa(job #1418688)

Utilizator VladuZ1338Vlad Vlad VladuZ1338 Data 13 aprilie 2015 18:36:09
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.5 kb
#include <cstdio>
#include <map>

using namespace std;

int i, n, tmp, t, x;
map <int, int> M;

int main()
{
    freopen ("hashuri.in", "r", stdin);
    freopen ("hashuri.out", "w", stdout);
    scanf ("%d", &n);
    for (i=1; i<=n; i++)
    {
        scanf ("%d%d", &t, &x);
        if (t==1) if (M.find(x)==M.end()) M[x]=++tmp;
        if (t==2) M.erase(x);
        if (t==3)
        {
            if (M.find(x)==M.end()) printf ("0\n");
            else printf ("1\n");
        }
    }
}