priority_queue 中存放pair时,自定义排序的写法

struct cmp
    {template <typename T, typename U>
        bool operator()(T const &left, U const &right)
        {
        // 以 second 比较。输出结果为 Second 较大的在前 Second 相同时,先进入队列的元素在前。
            if (left.second < right.second)
                return true;
            return false;
        }
    };
    // new.
    priority_queue<pair<int, int>, vector<pair<int, int>>, cmp> pq;