Cod sursa(job #403524)

Utilizator blasterzMircea Dima blasterz Data 25 februarie 2010 01:20:41
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.69 kb
#include <cstdio>
#include <tr1/unordered_set>

#define dim 8192
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;
	}
}


using namespace std;


int main()
{
	tr1::unordered_set<int> H;	
	int n, p, q;
	freopen ("hashuri.in", "r", stdin);
	freopen ("hashuri.out", "w", stdout);
	cit (n);

	while (n--)
	{
		
		cit (p); cit (q);

		if (p == 1)
			H.insert (q);
		if (p == 2)
			H.erase (q);
		if (p == 3)
			printf ("%d\n", H.find(q) == H.end() ? 0 : 1);

	}

	return 0;
}