Cod sursa(job #1253330)

Utilizator PTAdrian64Pop-Tifrea Adrian PTAdrian64 Data 1 noiembrie 2014 09:24:01
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.89 kb
#include <cstdio>
#include <map>
#define ll long long
#define h_value 65536*4-1

using namespace std;

ll n,m;
map <ll,ll> map_1;

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

    scanf("%lld ",&n );
    ll y;
    int x;
    map < ll , ll > :: iterator it;
    while(n--){
         scanf("%d %lld ",&x ,&y );

         if( x==1 ){
             it = map_1.find(y);
            if(it == map_1.end()){
                 //map_1.insert(pair<ll,ll>(y,y%h_value));
                 map_1[y] = y%h_value;
            }
            continue;
         }

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

    return 0;
}