Cod sursa(job #393430)

Utilizator marinaMarina Horlescu marina Data 9 februarie 2010 14:27:54
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.43 kb
#include <fstream>
#include <map>

using namespace std;

map<int, int> hash;

int main()
{
	ifstream f("hashuri.in");
	ofstream g("hashuri.out");
	
	int n;
	f >> n;
	int x, y , i;
	for(i = 0; i < n; ++i)
	{
		f >> x >> y;
		if(x == 1 && hash.find( y ) == hash.end()) 
			hash.insert(make_pair(y, 1));
		else if(x == 2) hash.erase(y); 
		else if(x == 3) g << (hash.find(y) != hash.end())  << "\n";
	}
	return 0;
}