Pagini recente » Cod sursa (job #2413120) | Cod sursa (job #1434117) | Cod sursa (job #1812331) | Cod sursa (job #352983) | Cod sursa (job #2742828)
#include <iostream>
#include <fstream>
#include <set>
using namespace std;
ifstream f("heapuri.in");
ofstream o("heapuri.out");
set<int> heap;
int pozitie[200001];
int main() {
int n, i, op, x, cnt=0;
f >> n;
for (i = 0; i < n; i++) {
f >> op;
if (op == 1) {
f >> x;
pozitie[++cnt]=x;
heap.insert(x);
} else if (op == 2) {
f >> x;
heap.erase(pozitie[x]);
} else {
o << *heap.begin() << '\n';
}
}
f.close();
o.close();
return 0;
}