44分WA求助
查看原帖
44分WA求助
1494926
wuchengjun05楼主2024/11/28 22:12

要排序还要去重,所以用set

#include<bits/stdc++.h>
using namespace std;
int i,n,p,x;
set<int> se;
set<int>::iterator it;
signed main(){
    cin>>n;
    for(i=1;i<=n;i++){
        cin>>p;
        if(p==1){
            cin>>x;
            se.insert(x);
        }
        else if(p==2){
            it=se.begin();
            cout<<*it<<endl;
        }
        else{
            it=se.begin();
            int c=*it;
            se.erase(c);
        }
    }
}
2024/11/28 22:12
加载中...