Cod sursa(job #3189613)

Utilizator Mihai_OctMihai Octavian Mihai_Oct Data 6 ianuarie 2024 12:08:38
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.5 kb
#include <bits/stdc++.h>

using namespace std;

ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
int t, op, x, ord[200002], k;
multiset<int> h;

int main() {
    fin >> t;
    while(t--) {
        fin >> op;
        if(op == 1) {
            fin >> x;
            ord[++k] = x;
            h.insert(x);
        }
        else if(op == 2) {
            fin >> x;
            h.erase(h.find(ord[x]));
        }
        else fout << *h.begin() << "\n";
    }

    return 0;
}