Cod sursa(job #1643107)

Utilizator gapdanPopescu George gapdan Data 9 martie 2016 17:36:26
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.45 kb
#include <unordered_map>
#include <cstdio>

using namespace std;

int T,x,t;
unordered_map<int,int>H;

int main()
{
    freopen("hashuri.in","r",stdin);
    freopen("hashuri.out","w",stdout);
    scanf("%d",&T);
    while(T>0)
    {
        scanf("%d%d",&t,&x);
        if(t == 1) ++H[x];
            else if(t==2) {if(H[x]!=0)--H[x];}
                else if(H[x]!=0) printf("1\n");
                    else printf("0\n");
        --T;
    }
    return 0;
}