Cod sursa(job #3005246)

Utilizator biancalautaruBianca Lautaru biancalautaru Data 16 martie 2023 20:39:04
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.52 kb
#include <fstream>
#include <set>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
int t,op,nr,x,poz[200001];
multiset<int> s;
int main() {
    fin>>t;
    while (t--) {
        fin>>op;
        if (op==1) {
            fin>>x;
            s.insert(x);
            poz[++nr]=x;
        }
        else
            if (op==2) {
                fin>>x;
                s.erase(poz[x]);
            }
            else
                fout<<*s.begin()<<"\n";
    }
    return 0;
}