Cod sursa(job #2859196)

Utilizator rares89_Dumitriu Rares rares89_ Data 28 februarie 2022 23:24:56
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.52 kb
#include <bits/stdc++.h>
 
using namespace std;
 
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
 
multiset<int> h;
int v[200002], n, c, x, m;
 
int main() {
    fin >> n;
    for(int i = 1; i <= n; i++) {
        fin >> c;
        if(c == 1) {
            fin >> x;
            v[++m] = x;
            h.insert(x);
        } else if(c == 2) {
            fin >> x;
            h.erase(v[x]);
        } else if(c == 3) {
            fout << (*h.begin()) << "\n";
        }
    }
    return 0;
}