1 struct cmp 2 { 3 bool operator ()(vector<int> &a, const vector<int> &b) 4 { 5 // < :大顶堆 6 // > :小顶堆 7 return a[0]+a[1] > b[0]+b[1]; 8 } 9 }; 10 priority_queue<vector<int>, vector<vector<int>>, cmp> pq;
原文:https://www.cnblogs.com/yuhong1103/p/12781648.html