如果你用的dij求最短路,而且用了类似priority_queue<node>的优先队列的话node的重载运算符里面符号要和实际的重载函数名相反,大概应该是这样子
struct node
{
int id,value;
bool operator <(node other) const
{
return value>other.value;
}
};
...
priority_queue<node> q;
附赠一组hack数据:
input:
1
6 6 10 998244353
1 2 4
2 5 3
1 3 6
3 4 5
4 6 2
5 4 0
output:
2