Cod sursa(job #2889996)

Utilizator widzAndrei-Daniel Tava widz Data 14 aprilie 2022 08:14:47
Problema Hashuri Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.72 kb
#include <fstream>
#include <iostream>
#include <vector>

using namespace std;


class EasyHash
{
private:
	vector<bool> storage;
public:
	EasyHash() : storage(2000000000) {};
	vector<bool>::reference operator[](const long long& nr)
	{
		return storage[nr];
	}
};

int main()
{
	ifstream in("hashuri.in");
	ofstream out("hashuri.out");
	EasyHash set;
	int operations;
	long long parameter;
	short command;
	in >> operations;
	for(int i=0;i<operations;++i)
	{
		in >> command >> parameter;
		switch(command)
		{
		case 1:
			set[parameter] = true;
			break;
		case 2:
			set[parameter] = false;
			break;
		case 3:
			out << set[parameter] << "\n";

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

	
}