文章
2
粉丝
0
获赞
7
访问
1.2k
#include <iostream>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;
const int N = 1010, M = 10010, mode = 1e9 + 7;
int n, m, s, t;
int h[N], e[M], ne[M], w[M], idx;
bool st[N];
int dist[N], cnt[N], path[N]; //dist统计最短路长度,cnt统计最短路数量,path统计最短路来自于哪个节点
void add(int a, int b, int c)
{
e[idx] = b, ne[idx] = h[a], w[idx] = c, h[a] = idx ++;
}
void spfa(int s)
{
memset(dist, 0x3f, sizeof dist);
dist[s] = 0;
cnt[s] = 1;
queue<int> q;
q.push(s);
st[s] = true;
while(q.size())
{
auto t ...
登录后发布评论
暂无评论,来抢沙发