优先队列重载比较运算

优先队列默认由大到小,由小到大可以为 priority_queue<int,vector<int>,greater<int> > q;

typedef struct node
{
    int pi;
    int di;
    bool operator < (const node &b)const
    {
        if(pi == b.pi)
            return di > b.di;
        else
            return pi > b.pi;
    }
} stone;
原文地址:https://www.cnblogs.com/acmLLF/p/13658441.html