Pagini recente » Cod sursa (job #347837) | Cod sursa (job #1337341) | Cod sursa (job #1310450) | Cod sursa (job #2613487) | Cod sursa (job #2738482)
#include <bits/stdc++.h>
using namespace std;
ifstream in("heapuri.in");
ofstream out("heapuri.out");
const int max_n = (int)2e5 + 5;
int n, m;
int ops[max_n];
multiset<int> ms;
int main() {
in >> n;
for (int i = 1; i <= n; i++) {
int op, x;
in >> op;
if (op == 1) {
in >> x;
ms.insert(x);
ops[m++] = x;
} else if (op == 2) {
in >> x;
ms.erase(ops[x - 1]);
} else {
out << *ms.begin() << "\n";
}
}
return 0;
}