Cod sursa(job #479697)

Utilizator deneoAdrian Craciun deneo Data 24 august 2010 21:30:04
Problema Hashuri Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.43 kb

#include <stdio.h>
#include <hash_set>

using namespace std;
using namespace __gnu_cxx;

int n;
hash_set< int, hash<int> > s;
int main()
{
	freopen("hashuri.in", "r", stdin);
	freopen("hashuri.out", "w", stdout);

	int i, tip, x;

	scanf("%d ", &n);

	for (i = 1; i <= n; i++) 
	{
		scanf("%d %d ", &tip, &x);

		if (tip == 1) s.insert(x);
		if (tip == 2) s.erase(x);
		if (tip == 3) printf("%d\n", s.find(x) != s.end() );
	}

	return 0;
}