Cod sursa(job #1097148)

Utilizator bogdanpaunFMI Paun Bogdan Gabriel bogdanpaun Data 3 februarie 2014 02:20:15
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.56 kb
#include <stdio.h>
#include <map>
using namespace std;
std::map<int,int> MyMap;
int N;

int main()
{
    freopen("hashuri.in" ,"r",stdin);
    freopen("hashuri.out","w",stdout);
    scanf("%d", &N);
    int OPTION,VALUE;
    for(; N; --N ){
            scanf("%d%d", &OPTION, &VALUE );
        if( OPTION == 1  && MyMap.find( VALUE ) == MyMap.end() ){  MyMap[VALUE]=1; continue;    }
        if( OPTION == 2  ){  MyMap.erase(VALUE); continue; }
        if( OPTION == 3  )   printf("%d\n", (MyMap.find( VALUE ) != MyMap.end()) );
    }

    return 0;
}