Pagini recente » Cod sursa (job #1774426) | Cod sursa (job #2300519) | Cod sursa (job #1778386) | Cod sursa (job #1773422) | Cod sursa (job #2896054)
#include <fstream>
#include <set>
#include <vector>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
int main() {
vector<int> elemente_introduse;
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.push_back(x);
} else if (op == 2) {
fin >> x;
heap.erase(elemente_introduse[x - 1]);
} else if (op == 3) {
auto it = heap.begin();
fout << *it << "\n";
}
}
fin.close();
fout.close();
return 0;
}