Cod sursa(job #1599014)

Utilizator alex.vasiuVasiu Alexandru alex.vasiu Data 13 februarie 2016 15:36:42
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.4 kb
#include <fstream>
#include <map>

using namespace std;

int N, NR;
map <int, int> M;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int main()
{
	

	int i, tip, x;

	f >> N;

	for (i = 1; i <= N; i++)
	{
		f >> tip >> x;

		if (tip == 1 && M.find(x) == M.end()) M[x] = ++NR;
		if (tip == 2) M.erase(x);
		if (tip == 3) g<< (M.find(x) != M.end()?1:0)<<"\n";
	}

	return 0;
}