Cod sursa(job #1068566)

Utilizator gabriel.badeaGabriel Badea gabriel.badea Data 28 decembrie 2013 14:57:27
Problema Heapuri Scor 40
Compilator cpp Status done
Runda Arhiva educationala Marime 0.59 kb
#include <iostream>
#include <set>
#include <vector>
using namespace std;

#define NMAX 200001

int main()
{
	set<int> my_set;
	int aux_set[NMAX];
	int poz = 1;

	int N, op, x;

	freopen("heapuri.in", "r", stdin);
	freopen("heapuri.out", "w", stdout);

	cin >> N;

	for(int i = 0; i < N; ++i)
	{
		cin >> op;
		if(op != 3)
		{
			cin >> x;
			if(op == 1)
			{
				my_set.insert(x);
				aux_set[poz] = x;
				poz++;
			}
			else
				my_set.erase(aux_set[x]);
		}
		else
		{
			cout << *(my_set.begin()) << endl;
		}
	}

	return 0;
}