Cod sursa(job #1048111)

Utilizator thereauFMI Sandu Robert Stelian thereau Data 5 decembrie 2013 12:35:21
Problema Hashuri Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.64 kb
#include <iostream>
#include <fstream>
#include <map>
using namespace std;
int main()
{
	map<int, int>operatie;
	ifstream citire;
	citire.open("hasuri.in");
	ofstream scriere;
	scriere.open("hasuri.out");
	int n, op, x;
	citire >> n;
	for (int i = 0; i < n; i++)
	{
		citire >> op >> x;
		switch (op)
		{
		case 1:
			if (operatie.find(x) == operatie.end())operatie[x] = x;
			break;
		case 2:
			if (operatie.find(x) != operatie.end())operatie.erase(x);
			break;
		case 3:
			if (operatie.find(x) != operatie.end())scriere << "1\n";
			else scriere << "0\n";
			break;
		}
	}
	citire.close();
	scriere.close();
	return 0;
}