C++优先级队列
两种自定义优先级方式
struct node
{
int ind;double l;
bool operator<(const node& other) const {
return l < other.l;
}
};
priority_queue<node>pq;
struct cmp
{
bool operator()(const node &a,const node &b)
{
return a.l>b.l;
}
};
priority_queue<node,vector<node>,cmp>pq;