Cod sursa(job #2129084)

Utilizator tudor199G Tudor tudor199 Data 12 februarie 2018 14:52:51
Problema Heapuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.61 kb
#include <iostream>
#include <vector>
#include <set>
#include <fstream>

using namespace std;

ifstream fin("heapuri.in");
ofstream fout("heapuri.out");

int main(){
    set < int > heap;
    vector < int > ord(1);
    int n, o , x;
	fin>>n;
	while(n --){
        fin>>o;
        switch(o){
        case 1:
            fin>>x;
            ord.push_back(x);
            heap.insert(x);
            break;
        case 2:
            fin>>x;
            heap.erase(ord[x]);
            break;
        default:
            fout<<*heap.begin()<<"\n";
            break;
        }
	}
	return 0;
}