Cod sursa(job #1309252)

Utilizator serban_ioan97Ciofu Serban serban_ioan97 Data 5 ianuarie 2015 16:40:30
Problema Hashuri Scor 20
Compilator cpp Status done
Runda Arhiva educationala Marime 0.58 kb
#include <cstdio>
#include <map>

using namespace std;

int n, type, i, x, qq;
map<int, int> kush;

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

    scanf("%d", &n);

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

        if(type==1 && kush.find(x)==kush.end())
        {
            kush[x]=++qq;
            continue;
        }

        if(type==2)
        {
            kush.erase(x);
            continue;
        }

        printf("%d\n", kush.find(x)!=kush.end());
    }
    return 0;
}