Cod sursa(job #2600179)

Utilizator OvidRata Ovidiu Ovid Data 12 aprilie 2020 11:02:06
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.6 kb
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
ifstream fin("heapuri.in"); ofstream fout("heapuri.out");


int n, e[200010];

multiset<int> heap;


int main(){
fin>>n;

int j=1;
for(int i=1; i<=n ; i++){
    int x, o;
    fin>>o;
    if(o==1){
        fin>>x;
        heap.insert(x);
        e[j]=x;
        j++;
    }
    if(o==2){
            fin>>x;
        heap.erase(heap.find(e[x]) );
    }
    if(o==3){
        fout<<*(heap.begin())<<"\n";
    }

}




return 0;
}