#include<iostream>
#include<queue>
#include<cstring>
using namespace std;
int a[1000010];
bool cmp(int a,int b){
return a>b;
}
struct node{
int a,b;
node (int a,int b)
{
this->a=a;
this->b=b;
}
bool operator <(const node &w)const
{
if(a!=w.a)
return a>w.a;
else
return b>w.b;
}
};
int main(){
int n,m;
int i=0;
priority_queue<node>Q;
while(scanf("%d%d",&n,&m)&&(n||m)){
Q.push(node(n,m));
}
while(!Q.empty())
{
cout<<Q.top().a<<' '<<Q.top().b<<endl;
Q.pop();
}
return 0;
}
C++优先队列的用法
最新推荐文章于 2024-06-18 17:11:56 发布