Cod sursa(job #1096373)

Utilizator pulseOvidiu Giorgi pulse Data 1 februarie 2014 21:59:30
Problema Hashuri Scor 20
Compilator cpp Status done
Runda Arhiva educationala Marime 0.47 kb
#include <cstdio>
#include <map>

using namespace std;

int T, count;
map <int, int> M;

int main ()
{
	freopen ("hashuri.in", "r", stdin);
	freopen ("hashuri.out", "w", stdout);
	scanf ("%d", &T);
	while (T--)
	{
		int type, x;
		scanf ("%d %d", &type, &x);
		if (type == 1 && M.find (x) == M.end ())
		{
			M[x] = ++count;
			continue;
		}
		if (type == 2)
		{
			M.erase (x);
			continue;
		}
		printf ("%d\n", M.find (x) != M.end ());
	}
	return 0;
}