Pagini recente » Cod sursa (job #1922151) | Cod sursa (job #702437) | Cod sursa (job #2285621) | Cod sursa (job #2276657) | Cod sursa (job #2895972)
#include <fstream>
#include <set>
#include <iostream>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
set<int> heap;
int main() {
int n, x, y, poz[200001], position = 0;
set<int> heap;
f >> n;
for (int i = 1; i <= n; i++) {
f >> x;
if (x == 1) {
f >> y;
heap.insert(y);
position++;
poz[position] = y;
} else {
if (x == 2) {
f >> y;
heap.erase(poz[y]);
} else
g << *heap.begin() << "\n";
}
}
}