优先队列的自定义排序方法

struct cmp
{
    bool operator ()(Pair a,Pair b)    //你想要定义的比较函数
    {
        if(a.second-a.first==b.second-b.first)
            return a.first>b.first;
        return a.second-a.first<b.second-b.first;
    }
};
priority_queue<Pair,vector<Pair>,cmp>q;
原文地址:https://www.cnblogs.com/ljxdtc666/p/12894918.html