Pagini recente » Cod sursa (job #131901) | Cod sursa (job #2692209) | Cod sursa (job #1955172) | Cod sursa (job #2556717) | Cod sursa (job #2906455)
#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;
}