Cod sursa(job #1977047)

Utilizator pepsiM4A1Ozturk Arif pepsiM4A1 Data 4 mai 2017 21:59:51
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.48 kb
#include <cstdio>
#include <map>
using namespace std;
map<int,int>ap;
int main()
{
    freopen ("hashuri.in","r",stdin);
    freopen ("hashuri.out","w",stdout);
    int n;
    scanf("%d",&n);
    for(;n>0;--n)
    {
        int tip,val;
        scanf("%d%d",&tip,&val);
        if(tip==1) ap[val]++;
        else if(tip==2&&ap[val]>0) --ap[val];
        else if(tip==3)
        {
            if(ap[val]>0) printf("1\n");
            else printf("0\n");
        }
    }
}