Cod sursa(job #2905085)
Utilizator | Data | 19 mai 2022 15:34:36 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.56 kb |
#include <iostream>
#include <fstream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int N, o, x, v[200001], index = 0;
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;
++index;
} else if (o == 3) {
g<<*h.begin()<<'\n';
} else {
f>>x;
h.erase(v[x-1]);
}
}
return 0;
}