Cod sursa(job #1424063)

Utilizator cristibogdanPatrascu Cristian cristibogdan Data 23 aprilie 2015 12:38:01
Problema Heapuri Scor 10
Compilator cpp Status done
Runda Arhiva educationala Marime 0.5 kb
#include <fstream>
#include <set>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
multiset <int> h;
int v[200001],k,n,x,y,i;
int main()
{//h.insert(x)
//h.eras`e(h.find(v[k]))
  f>>n;
  for(i=1;i<=n;i++){
    f>>x;
    if(x==1)
    {
        f>>y;
        h.insert(y);
        v[++k]=y;
    }
else{
    if(x==2){
            f>>y;
            h.erase(h.find(v[y]));
            v[++k]=y;
            }
    else{
        g<<*h.begin()<<'\n';}
}}
    return 0;
}