Cod sursa(job #1155699)

Utilizator irimiecIrimie Catalin irimiec Data 27 martie 2014 09:10:32
Problema Hashuri Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.41 kb
#include <iostream>
#include <fstream>
#include <map>

using namespace std;

ifstream f("hashuri.in");
ofstream g("hashuri.out");

int n, nr, type, x;
map<int, int> hash;

int main()
{
	f >> n;
	nr = 0;
	for(int i = 0; i < n; ++i)
	{
		f >> type >> x;
		if(type == 1 && hash.find(x) == hash.end())
			hash[x] = nr++;
		if(type == 2)
			hash.erase(x);
		if(type == 3)
			g << (hash.find(x) != hash.end()) << "\n";
	}
}