Cod sursa(job #1363561)

Utilizator cristian.enciuCristian Enciu cristian.enciu Data 27 februarie 2015 01:30:54
Problema Hashuri Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.46 kb
#include<stdio.h>
#include<unordered_set>

using namespace std;

unordered_set<int> x;

int main()
{
	freopen("hashuri.in", "r", stdin);
	freopen("hashuri.out", "w", stdout);

	int n, m;

	scanf("%d%d", &n, &m);

	for(int i = 0 ; i < m ; ++i) {
		int op, val;
		scanf("%d%d", &op, &val);

		if(op == 1) x.insert(val);
		if(op == 2) x.erase(val);
		if(op == 3) if(x.find(val) != x.end()) printf("1\n");
		else printf("0\n");
	}

	return 0;
}