Cod sursa(job #1448097)

Utilizator StefanRARapeanu-Andreescu Stefan StefanRA Data 6 iunie 2015 10:16:44
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.58 kb
#include <fstream>
#include <unordered_set>

int main()
{
	std::ios_base::sync_with_stdio(false);

	int number_of_operations, value;
	char operation_type;

	std::unordered_set<int> hash;

	std::ifstream fin ("hashuri.in");
	std::ofstream fout ("hashuri.out");

	fin>>number_of_operations;
	while (number_of_operations--)
	{
		fin>>operation_type>>value;
		switch(operation_type)
		{
		case '1':
			hash.insert(value);
			break;
		case '2':
			hash.erase(value);
			break;
		case '3':
			fout<<(hash.find(value)!=hash.end())<<'\n';
			break;
		}
	}

	return 0;
}