Cod sursa(job #1369460)

Utilizator DysKodeTurturica Razvan DysKode Data 3 martie 2015 08:31:15
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.62 kb
#include <bits/stdc++.h>
using namespace std;

FILE* fin=fopen("hashuri.in","r");
FILE* fout=fopen("hashuri.out","w");

map <int,int> M;
map <int,int>::iterator it;

int x,y,n,i;

int main()
{
    fscanf(fin,"%d",&n);
    for(i=1 ; i<=n ; ++i)
    {
        fscanf(fin,"%d %d",&x , &y);
        if( x == 1 )
        {
            M[y]=1;
        }
        else if( x == 2 )
        {
            M.erase(y);
        }
        else if( x == 3 )
        {
            if( M[y] == 1 )
                fprintf(fout,"1\n");
            else
                fprintf(fout,"0\n");
        }
    }

return 0;
}