Cod sursa(job #441833)

Utilizator alexandru92alexandru alexandru92 Data 13 aprilie 2010 15:25:01
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 1.09 kb
/* 
 * File:   main.cpp
 * Author: VirtualDemon
 *
 * Created on April 12, 2010, 4:23 PM
 */
#include <cstdio>
#include <cstdlib>
#include <tr1/unordered_set>
#define SIZE 8192

/*
 *
 */
using namespace std;
using namespace tr1;
int ifile;
char file[SIZE];
unordered_set< int > s;
inline void read( int& x )
{
    x=0;
    while( file[ifile] < '0' || file[ifile] > '9' )
        if( ++ifile == SIZE )
        {
            fread( file, sizeof(char), SIZE, stdin );
            ifile=0;
        }
    while( file[ifile] >= '0' && file[ifile] <= '9' )
    {
        x=x*10+file[ifile]-'0';
        if( ++ifile == SIZE )
        {
            fread( file, sizeof(char), SIZE, stdin );
            ifile=0;
        }
    }
}
int main( void )
{
    int N, i, j;
    freopen( "hashuri.in", "rt", stdin );
    freopen( "hashuri.out", "wt", stdout );
    read(N);
    for( ; N; --N )
    {
        read(i); read(j);
        switch(i)
        {
            case 1 : s.insert(j); break;
            case 2 : s.erase(j); break;
            case 3 : printf( "%d\n", s.end() != s.find(j) );
        }
    }
    return EXIT_SUCCESS;
}