Cod sursa(job #1759435)

Utilizator Gigel-FroneGigel Fronel Gigel-Frone Data 19 septembrie 2016 10:07:01
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.44 kb
#include <cstdio>
#include <map>

using namespace std;

int main()
{
	freopen("hashuri.in", "r", stdin);
	freopen("hashuri.out", "w", stdout);
	
	map <int, int> m;
	int n, tip, x, no=0;
	scanf("%d", &n);
	
	for(int i=1; i<=n; i++)
	{
		scanf("%d %d", &tip, &x);
		
		if(tip==1 && m.find(x)==m.end()) m[x]=++no;
		if(tip==2) m.erase(x);
		if(tip==3)
		{
			int ok;
			if(m.find(x) != m.end()) ok=1;
			else ok=0;
			
			printf("%d\n",ok);
		}
	}
}