rt,重载了priority_queue中的<运算符,实现小根堆
#include<cstdio>
#include<iostream>
#include<queue>
using namespace std;
struct edge {
int to, cost;
};
priority_queue<edge>que;
bool operator <(const edge &a, const edge &b) {
return a.cost > b.cost;
}
int main()
{
que.push(edge{ 1,5 });
que.push(edge{ 3,4 });
que.push(edge{ 1,3 });
que.push(edge{ 1,10 });
que.push(edge{ 1,12 });
edge k = que.top();
cout << k.to << " " << k.cost << endl;
return 0;
}