Cod sursa(job #2169386)

Utilizator RaduVFVintila Radu-Florian RaduVF Data 14 martie 2018 15:08:16
Problema Heapuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.53 kb
#include <iostream>
#include <fstream>
#include <set>

using namespace std;

ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
const int nmax = 200002;
int n,x,y;
int v[nmax];
set < int > H;

int main()
{
    int contor=0;
    fin >> n;
    while(n--) {
        fin >> x;
        if(x==1) {
            fin >> v[++contor];
            H.insert(v[contor]);
        } else
        if(x==2) {
            fin >> y;
            H.erase(v[y]);
        } else fout << *H.begin() << "\n";
    }
    return 0;
}