Pagini recente » Cod sursa (job #1961339) | Cod sursa (job #2481690) | Cod sursa (job #602136) | Cod sursa (job #515871) | Cod sursa (job #2650856)
#include <bits/stdc++.h>
using namespace std;
#define NMAX 200010
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int ordine[NMAX];
set < int > heap;
int main() {
int n, ord = 0;
f >> n;
for (int i = 0; i < n; i++) {
int op, x;
f >> op;
if (op == 1) {
f >> x;
heap.insert(x);
ordine[ord++] = x;
} else if (op == 2) {
f >> x;
heap.erase(ordine[x]);
} else {
g << * (heap.begin()) << "\n";
}
}
return 0;
}