Cod sursa(job #1259070)

Utilizator PTAdrian64Pop-Tifrea Adrian PTAdrian64 Data 9 noiembrie 2014 17:59:29
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.8 kb
#include <cstdio>
#include <map>

using namespace std;

//long long n,nr;
//map <long long,long long> map_1;
map <int,int> map_1;
int nr,n;

int main()
{
    freopen("hashuri.in","r",stdin);
    freopen("hashuri.out","w",stdout);

    scanf("%d ",&n );
    //long long y;
    int y;
    int x;

    while(n--){
         scanf("%d %d ",&x ,&y );

         if( x == 1 ){

            if(map_1.find(y) == map_1.end()){
                 map_1[y] = ++nr;
            }
            continue;
         }

         if( x == 2 ){

                map_1.erase(y);
             continue;
         }
         if(x == 3){
              if(map_1.find(y) == map_1.end())
                 printf("0\n");
              else
                 printf("1\n");
         }
    }

    return 0;
}