Cod sursa(job #3235832)

Utilizator Mihai_OctMihai Octavian Mihai_Oct Data 22 iunie 2024 10:16:00
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.49 kb
#include <bits/stdc++.h>

using namespace std;

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

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

    return 0;
}