Cod sursa(job #2187365)

Utilizator killer301Ioan Andrei Nicolae killer301 Data 26 martie 2018 14:18:05
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.45 kb
#include <cstdio>
#include <map>

using namespace std;

map <int, int> m;

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