Cod sursa(job #2895497)

Utilizator NefelibataAnton Marius Alexandru Nefelibata Data 29 aprilie 2022 09:34:46
Problema Heapuri Scor 40
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.53 kb
#include <fstream>
#include<bits/stdc++.h>

using namespace std;

int main()
{
    ifstream f("heapuri.in");
    ofstream g("heapuri.out");
    int N, x, v[100000], index = 0;
    short o;
    multiset<int> h;
    f>>N;
    for (int i = 0; i < N; ++i) {
        f>>o;
        if (o == 1) {
            f>>x;
            h.insert(x);
            v[++index] = x;
        } else if (o == 2) {
            f>>x;
            h.erase(v[x]);
        } else {
            g<<*h.begin()<<endl;
        }
    }
    return 0;
}