/*********
Author Smile
优先队列的自定义优先级
不知道为什么,但是语法就是这样
对于结构体和非结构体的先记下吧
**********/
#include <bits/stdc++.h>
using namespace std;
struct node
{
int x, y;
friend bool operator < (node a, node b)
{
return a.x > b.x;
}
};
priority_queue<node, vector<node> > pq1;
struct comp
{
bool operator () (int &a, int &b)
{
return a > b;
}
};
priority_queue<int, vector<int>, comp> pq2;
int main()
{
return 0;
}
优先队列自定义优先级
最新推荐文章于 2024-07-23 15:46:40 发布