Cod sursa(job #1612314)

Utilizator MickeyTurcu Gabriel Mickey Data 24 februarie 2016 19:53:34
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.54 kb
#include <fstream>
#include <iostream>
#include <iomanip>
#include <unordered_set>
int nr, i, type;
double el;
using namespace std;

int main()
{
	ifstream f("hashuri.in");
	ofstream g("hashuri.out");
	unordered_set< int, hash<int> > M;
	unordered_set<int>::iterator it;
	f >> nr;
	for (i = 1;i <= nr;i++)
	{
		f >> type >> el;
		if (type == 1)M.insert(el);
		else
			if (type == 2)
				M.erase(el);
			else
			{
				it = M.find(el);
				if (it != M.end())
					g << "1\n";
				else
					g << "0\n";
			}

	}


	return 0;
}