Pagini recente » Cod sursa (job #1736164) | Profil StarGold2 | Cod sursa (job #1289939) | Cod sursa (job #784795) | Cod sursa (job #2761749)
#include<iostream>
#include<fstream>
#include <set>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
set<int>heap;
int v[200001];
int main() {
int n;
f >> n;
int comanda, x;
int k = 0;
for (int i = 1; i <= n; i++) {
f >> comanda;
if (comanda == 1) {
f >> x;
k++;
v[k] = x;
heap.insert(x);
}
else {
if (comanda == 2) {
f >> x;
heap.erase(v[x]);
}
else {
if (comanda == 3) {
g << *heap.begin() << endl;
}
}
}
}
f.close();
g.close();
return 0;
}