Pagini recente » Monitorul de evaluare | Cod sursa (job #2201844) | Cod sursa (job #179314) | Monitorul de evaluare | Cod sursa (job #2135940)
/*
#include <bits/stdc++.h>
using namespace std;
int main() {
freopen("carici.in", "r", stdin);
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
return 0;
}
*/
#include <bits/stdc++.h>
using namespace std;
int n;
multiset<int> heap;
int v[200001];
int main() {
freopen("carici.in", "r", stdin);
freopen("heap.in", "r", stdin);
freopen("heap.out", "w", stdout);
scanf("%d", &n);
int op;
int cnt = 0;
int x;
while (n--) {
scanf("%d", &op);
if (op == 1) {
scanf("%d", &x);
heap.insert(x);
v[cnt++] = x;
} else if (op == 2) {
scanf("%d", &x);
heap.erase(v[x - 1]);
} else {
cout << *heap.begin() << "\n";
}
}
return 0;
}