Cod sursa(job #2405076)

Utilizator Costy_Suruniuc Constantin Costy_ Data 13 aprilie 2019 21:35:07
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.59 kb
#include <iostream>
#include <map>
#include <fstream>
using namespace std;

map<int, bool> cont;

int prcs(int op, int val)
{
	switch (op)
	{
	case 1:
		cont[val] = true;
		break;
	case 2:
		cont[val] = false;
		break;
	case 3:
		return cont[val];
	default:
		break;
	}
	return -1;
}

int main()
{
	ifstream in;
	in.open("hashuri.in");
	ofstream out;
	out.open("hashuri.out");
	int n, op, val, res;
	in >> n;
	for (int i = 0; i < n; ++i)
	{
		in >> op >> val;
		res = prcs(op, val);
		if (res != -1)
		{
			out << res << '\n';
		}
	}
	in.close();
	out.close();
}