priority

it2025-11-12  5

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;

转载于:https://www.cnblogs.com/ruoh3kou/p/11230502.html

最新回复(0)