ybt你别太荒谬,tmSTL优先队列我本来就比较five,但是™凹了两个半小时的模拟题都tm能超时,然后还是只超1ms,无语死了,C。
这是题目
#include<bits/stdc++.h>
using namespace std;
int n;
string op;
struct node{
string name;
int p;
}s;
priority_queue<node,vector<node>,less<node> >q;
bool operator<(const node &a,const node &b){
return a.p<b.p;
}
int main(){
ios::sync_with_stdio(false);
cin>>n;
for(int i=1;i<=n;i++){
cin>>op;
if(op=="pop"){
if(q.empty()){
cout<<"none\n";
continue;
}
cout<<q.top().name<<" "<<q.top().p<<"\n";
q.pop();
}
else{
cin>>s.name>>s.p;
q.push(node{s.name,s.p});
}
}
}
求大佬