Pagini recente » Cod sursa (job #752834) | Cod sursa (job #1510928) | Cod sursa (job #1580434) | Cod sursa (job #3248868) | Cod sursa (job #2895456)
#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, i;
multiset<int> h;
f>>N;
for (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;
}