Cod sursa(job #1729977)

Utilizator RG1999one shot RG1999 Data 15 iulie 2016 23:25:22
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.88 kb
#include <bits/stdc++.h>
using namespace std;
map <int,int > bgd;
using namespace std;
int n,i,v,x;
#define DIM 10000
char buff[DIM];
int poz=0;
void citeste(int &numar)
{
     numar = 0;
     while (buff[poz] < '0' || buff[poz] > '9')
          if (++poz == DIM)
               fread(buff,1,DIM,stdin),poz=0;
     while ('0'<=buff[poz] && buff[poz]<='9')
     {
          numar = numar*10 + buff[poz] - '0';
          if (++poz == DIM)
               fread(buff,1,DIM,stdin),poz=0;
     }
}
int main()
{
    freopen("hashuri.in","r",stdin);
    freopen("hashuri.out","w",stdout);
    citeste(n);
    for(i=1;i<=n;i++)
    {
        citeste(v),citeste(x);
        if(v==1&&bgd[x]==0)
            bgd[x]=1;
        else
            if(v==2&&bgd[x]==1)
            bgd[x]=0;
        else
            if(v==3)
            printf("%d\n",bgd[x]);

    }
    return 0;
}