Pagini recente » Cod sursa (job #2573283) | Cod sursa (job #452431) | Cod sursa (job #497412) | Cod sursa (job #889298) | Cod sursa (job #3350598)
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
#define N 200005
int main(){
multiset<ll> h;
int n, cnt = 0;
ll a[N] = { 0 };
fin >> n;
while(n--){
int c;
fin >> c;
if(c < 3){
int x;
fin >> x;
if(c == 1){
h.insert(x);
a[++cnt] = x;
}
if(c == 2){
h.erase(a[x]);
}
}
else{
multiset <ll> :: iterator it = h.begin();
fout << *it << '\n';
}
}
return 0;
}