Cod sursa(job #425710)

Utilizator slayer4uVictor Popescu slayer4u Data 25 martie 2010 23:32:15
Problema Hashuri Scor 30
Compilator cpp Status done
Runda Arhiva educationala Marime 0.51 kb
#include <cstdio>
#include <vector>
#include <set>
using namespace std;

#define P 666013

multiset <int> hash[P];

long n, code, x;

int main()
{
	freopen ("hashuri.in", "rt", stdin);
	freopen ("hashuri.out", "wt", stdout);

	scanf("%ld", &n);
	for (long i = 0; i < n; ++i)
	{
		scanf("%ld %ld", &code, &x);
		if (code == 3)
			printf("%ld\n", hash[x % P].find(x) != hash[x % P].end());
		else
		if (code == 1)
			hash[x % P].insert(x);
		else
			hash[x % P].erase(x);
	}

	return 0;
}