这是目前最简单的题解了

· · 题解

用STL,进行操作


#include <bits/stdc++.h>
using namespace std;
priority_queue <int,vector<int>,greater<int> > q;
int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        int a;
        cin>>a;
        if(a==1){//1时插入
            int b;
            cin>>b;
            q.push(b);
        }
        else if(a==2){//输出
            cout<<q.top()<<endl;
        }
        else if(a==3){//弹出
            q.pop();
        }
    }
    return 0;}
}