Cod sursa(job #711709)

Utilizator danalex97Dan H Alexandru danalex97 Data 12 martie 2012 18:27:56
Problema Hashuri Scor 30
Compilator cpp Status done
Runda Arhiva educationala Marime 0.61 kb
#include <fstream>
using namespace std;

#define Pmax 2000011 // parametru maxim
#define TipOp int

bool H[Pmax];
int N,x;
TipOp tip;

inline void Add(int x)
{ H[x]=1; }

inline void Del(int x)
{ H[x]=0; }

inline bool Caut(int x)
{ return H[x]; }

inline void Tipar(int x)
{ if ( Caut(x) ) printf("1\n");
			else printf("0\n"); }

int main()
{
	freopen("hashuri.in","r",stdin);
	freopen("hashuri.out","w",stdout);
	
	scanf("%d",&N);
	
	for (int i=1;i<=N;++i)
	{
		scanf("%d%d",&tip,&x);
	
		if (tip==1) Add(x);
		if (tip==2) Del(x);
		if (tip==3) Tipar(x);
	
	}
	
	return 0;
}