本文共 717 字,大约阅读时间需要 2 分钟。
#include#include #include using namespace std;struct Pair{ int id; string data;};bool operator<(Pair p1,Pair p2){ return p1.id tmp; tmp.push({ 3,"a"}); tmp.push({ 2,"b"}); cout<
#include#include #include using namespace std;struct Pair{ int id; string data;};bool operator<(Pair p1,Pair p2){ return p1.id>p2.id;}int main() { //小根堆 priority_queue tmp; tmp.push({ 3,"a"}); tmp.push({ 2,"b"}); cout<
//int型的定义//1.大根堆:priority_queue tmp;//2.小根堆:priority_queue,greater > tmp;
转载地址:http://nllzi.baihongyu.com/