Cod sursa(job #916374)

Utilizator cont_testeCont Teste cont_teste Data 16 martie 2013 13:48:59
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.73 kb

#include<vector>
#include<algorithm>
#include<cstdio>
#include<map>


#define MOD 660013

FILE *f=fopen("hashuri.in","r");
FILE *g=fopen("hashuri.out","w");

using namespace std;

int n,type;
map<int,bool>M;

int main( void )
{
    fscanf(f,"%d",&n);

    for(int i(1); i <= n ; ++i )
    {
        int x;
       fscanf(f,"%d%d",&type,&x);
       if(type ==1 && M.find(x)==M.end() )
        {
            M.insert(pair<int,bool>(x,1));
            continue;
        }
        if(type == 2)
        {
            M.erase(x);
            continue;
        }
        if(type == 3 )
        {
            fprintf(g,"%d\n",M.find(x)!=M.end());
        }
    }
    fclose(f);
    fclose(g);
    return 0;
}