#include<bits/stdc++.h>
using namespace std;
struct node{
int x,y;
bool operator <(const node b)const{
return this->x>b.x;
}
};
priority_queue <node> q;
int main(){
int i,j,k,m,n;
cin>>n;
for(i=1;i<=n;i++){
node t;
cin>>t.x>>t.y;
q.push(t);
}
while(!q.empty()){
node t=q.top();
cout<<t.x<<" "<<t.y<<endl;
q.pop();
}
return 0;
}
//priority_queue < int ,vector<int> , greater<int> > q;
/*
input:
3
33 11
2 55
15 8
out:
2 55
15 8
33 11
*/
C++STL系列 结构体运算符重载及优先队列的使用
最新推荐文章于 2024-07-23 20:22:16 发布