Cod sursa(job #1048187)

Utilizator TwoOfDiamondsDaniel Alexandru Radu TwoOfDiamonds Data 5 decembrie 2013 15:14:40
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.43 kb
#include <unordered_set>
#include <fstream>

using namespace std;

int main()
{
	ifstream IN("hashuri.in");
	ofstream OUT("hashuri.out");
	unordered_set<int> hash;
	int n;IN >> n;
	int t, x;
	
	for (int i = 0 ; i < n; i++)
	{
		IN >> t >> x;
		if (t == 1)
			hash.insert(x);
		else if (t == 2)
			hash.erase(x);
		else 
			if (hash.find(x) == hash.end())
				OUT << "0\n";
			else
				OUT << "1\n";
	}
	return 0;
}