Cod sursa(job #441825)

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

/*
 * 
 */
using namespace std;
using namespace tr1;
unordered_set< int > s;
char ax[dim];
int pz;
inline void read( int &x )
{
	x = 0;
	while (ax[pz] < '0' || ax[pz] > '9')
		if (++pz == dim)
			fread (ax, 1, dim, stdin),pz = 0;
	while (ax[pz] >= '0' && ax[pz] <= '9')
	{
		x = x * 10 + ax[pz] - '0';
		if (++pz == dim)
			fread (ax,1, dim, stdin),pz = 0;
	}
}
int main(int argc, char** argv)
{
    int N, i, j;
    freopen( "hashuri.in", "rt", stdin );
    freopen( "hashuri.out", "wt", stdout );
    for( read(N); 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;
}