#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
using namespace std;
struct Node{
int x , y;
Node(int a = 0 , int b = 0){
x = a , y = b;
}
};
bool operator<(Node a , Node b){
if(a.x == b.x) return a.y>b.y;
return a.x>b.x;
}
int main(){
priority_queue<Node> q;
q.push(Node(0 , 1));
q.push(Node(1 , 1));
q.push(Node(1 , 2));
while(!q.empty()){
Node t = q.top();
q.pop();
cout << t.x<<" " << t.y << endl;
}
return 0;
}
结构体优先队列排序
最新推荐文章于 2025-05-21 15:29:01 发布