Pagini recente » Cod sursa (job #2739848) | Rating Pasparan Gabriel (gabytzu_4you2002) | Cod sursa (job #406) | Cod sursa (job #2671790) | Cod sursa (job #2895465)
#include <iostream>
#include <fstream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int N, o, v[200001], index = 0, i;
multiset<int> h;
f>>N;
for (i = 0; i < N; ++i) {
f>>o;
if (o == 1) {
f>>o;
h.insert(o);
v[++index] = o;
} else if (o == 2) {
f>>o;
h.erase(v[o]);
} else {
g<<*h.begin()<<endl;
}
}
return 0;
}