Pagini recente » Cod sursa (job #2728466) | Cod sursa (job #924192) | Cod sursa (job #884845) | Cod sursa (job #2105318) | Cod sursa (job #441849)
Cod sursa(job #441849)
/*
* File: main.cpp
* Author: VirtualDemon
*
* Created on April 12, 2010, 4:23 PM
*/
#include <cstdlib>
#include <fstream>
#include <tr1/unordered_set>
#define SIZE 8219
/*
*
*/
using namespace std;
using namespace tr1;
ifstream in;
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 )
{
in.read( file, SIZE );
ifile=0;
}
while( file[ifile] >= '0' && file[ifile] <= '9' )
{
x=x*10+file[ifile]-'0';
if( ++ifile == SIZE )
{
in.read( file, SIZE );
ifile=0;
}
}
}
int main( void )
{
int N, i, j;
in.open( "hashuri.in" );
ofstream out( "hashuri.out" );
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 : out<<( s.end() != s.find(j) )<<'\n';
}
}
return EXIT_SUCCESS;
}