Cod sursa(job #479696)

Utilizator deneoAdrian Craciun deneo Data 24 august 2010 21:29:07
Problema Hashuri Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.4 kb

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

using namespace std;

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;
}