Cod sursa(job #694221)

Utilizator wizekidNeagu Gabriel wizekid Data 27 februarie 2012 19:23:49
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.41 kb
#include <fstream>
#include <map>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int n;
map <int, int> tabela;
int main()
{   int i, tip, x;
    f>>n;
	for (i=1;i<=n;i++) 
	{   f>>tip>>x;
		if (tip==1 && tabela.find(x)==tabela.end()) tabela[x]=1;
		if (tip==2) tabela.erase(x);
		if (tip==3) if(tabela.find(x)!=tabela.end()) g<<"1"<<"\n"; 
		              else g<<"0\n";
	}
	return 0;
}