Cod sursa(job #1759431)

Utilizator Gigel-FroneGigel Fronel Gigel-Frone Data 19 septembrie 2016 09:49:42
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.4 kb
#include <fstream>
#include <map>

using namespace std;

int main()
{
	ifstream f("hashuri.in");
	ofstream g("hashuri.out");
	
	map <int, int> m;
	int n, tip, x, no=0;
	f >> n;
	
	for(int i=1; i<=n; i++)
	{
		f >> tip >> x;
		
		if(tip==1 && m.find(x)==m.end()) m[x]=++no;
		if(tip==2) m.erase(x);
		if(tip==3)
		{
			bool ok;
			if(m.find(x) != m.end()) ok=1;
			else ok=0;
			
			g << ok << "\n";
		}
	}
}