Cod sursa(job #2029178)

Utilizator secenAxinte Gabriel secen Data 29 septembrie 2017 16:49:21
Problema Hashuri Scor 30
Compilator cpp Status done
Runda Arhiva educationala Marime 0.45 kb

#include <fstream>
using namespace std;
bool vec[1000099];
int h(int n)
{
	return n % 1000099;
}
int main()
{
	ifstream fin("hashuri.in");
	ofstream fout("hashuri.out");
	unsigned n;
	fin >> n;
	for (unsigned i = 0; i < n; i++)
	{
		int aux, p;
		fin >> p >> aux;
		switch (p)
		{
		case 1:
			vec[h(aux)] = 1;
			break;
		case 2:
			vec[h(aux)] = 0;
			break;
		case 3:
			fout << vec[h(aux)]<<"\n";
			break;
		}
	}
	return 0;
}