Cod sursa(job #1126276)

Utilizator jumper007Raul Butuc jumper007 Data 26 februarie 2014 22:20:47
Problema Hashuri Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.51 kb
#include <fstream>
#include <hash_set.h>

using namespace std;
using namespace __gnu_cxx;

hash_set<int, hash<int> > H;

int main(int argc, char *argv[]) {
	long nr, x;
	short op;
	fstream in("hashuri.in", ios::in);
	fstream out("hashuri.out", ios::out);
	
	in >> nr;
	for (int i = 0; i < nr; ++i) {
		in >> op >> x;
		switch(op) {
			case 1:
				H.insert(x);
			case 2:
				H.erase(x);
			case 3:
				out << (H.find(x) == H.end()) << "\n";
		}
	}

	in.close();
	out.close();

	return 0;
}