Cod sursa(job #881839)

Utilizator Daniel_BotBot Cristian Daniel Daniel_Bot Data 18 februarie 2013 18:16:36
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.63 kb
#include <iostream>
#include <map>
#include<stdio.h>
using namespace std;

map < int , int > M;
int n;
int op,elem,key=0;

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,&elem);
        if(op==1)
        {
            if(M.find(elem)==M.end())
                M[elem]= ++key;
        }
        if(op==2)
            M.erase(elem);
        if(op==3)
        {
            if(M.find(elem)!=M.end())
                printf("1\n");
            else    printf("0\n");
        }
    }
    return 0;
}