Cod sursa(job #1163504)

Utilizator eugen_ptrEugen Patru eugen_ptr Data 1 aprilie 2014 13:44:00
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.64 kb
#include <iostream>
#include <cstdio>
#include <map>

using namespace std;

int n;
map <int, int> M;

int main()
{
    freopen("hashuri.in","r",stdin);
    freopen("hashuri.out","w",stdout);
    scanf("%d",&n);

    int NR = 0;
    while( n-- )
    {
        int tip, x;
        scanf("%d %d",&tip, &x);
        switch(tip)
        {
            case 1: if (M.find(x)==M.end())
                        M[x] = ++NR;
                    break;
            case 2: M.erase(x);
                    break;
            case 3: printf("%d\n", M.find(x) != M.end());
                    break;
        }
    }
    return 0;
}