Pagini recente » Cod sursa (job #2517996) | Cod sursa (job #293210) | Cod sursa (job #2382014) | Cod sursa (job #685400) | Cod sursa (job #2896059)
#include <fstream>
#include <set>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
int main() {
int elemente_introduse[200001], count = 0;
set<int> heap;
int n, op, x;
fin >> n;
for (int i = 0; i < n; i++) {
fin >> op;
if (op == 1) {
fin >> x;
heap.insert(x);
elemente_introduse[++count] = x;
} else if (op == 2) {
fin >> x;
heap.erase(elemente_introduse[x]);
} else if (op == 3) {
auto it = heap.begin();
fout << *it << "\n";
}
}
fin.close();
fout.close();
return 0;
}