Cod sursa(job #1455758)

Utilizator tamionvTamio Vesa Nakajima tamionv Data 29 iunie 2015 00:47:12
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.45 kb
#include <vector>
#include <unordered_set>
#include <fstream>
using namespace std;

int main(){
	ifstream f("hashuri.in");
	ofstream g("hashuri.out");
	int n;
	f >> n;
	int tip;
	long long val;
	unordered_set<long long> hs;
	hs.reserve(n);
	for(int i = 0; i < n; ++i){
		f >> tip >> val;
		switch(tip){
		case 1:
			hs.insert(val);
			break;
		case 2:
			hs.erase(val);
			break;
		case 3:
			g << (hs.find(val)!=end(hs)) << '\n';
			break; } }
	return 0; }