Cod sursa(job #531033)

Utilizator c_adelinaCristescu Adelina c_adelina Data 8 februarie 2011 20:19:41
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.67 kb
#include <hash_set.h>
#include <cstdio>
#define dim 8192

using namespace std;
using namespace __gnu_cxx;
hash_set< int, hash<int> > v;

char ax[dim];
int pz;

inline void cit(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 n, x, y;
	freopen("hashuri.in","r",stdin);
	freopen("hashuri.out","w",stdout);
	cit(n);
	for( ; n; --n )
	{
		cit(x);cit(y);
		switch( x )
		{
			case 1: v.insert(y); break;
			case 2: v.erase(y); break;
			case 3: printf("%d\n", v.end() != v.find(y)); break;
		}
	}
	return 0;
}