struct node{
int r,n;
node (int a,int b):r(a),n(b){}//记住就行
bool operator < (const node a)const{//重载运算符
return a.r<r;
}
};
priority_queue<node>q;
q.push(node{r,n});
优先队列结构体排序
最新推荐文章于 2024-07-23 20:22:16 发布
struct node{
int r,n;
node (int a,int b):r(a),n(b){}//记住就行
bool operator < (const node a)const{//重载运算符
return a.r<r;
}
};
priority_queue<node>q;
q.push(node{r,n});