#include
#include
#include
#include
using namespace std;
const int N = 10010;
typedef pair
priority_queue < pll, vector
int g[N][N], dist[N]; bool str[N];
int n; int idx, en[N], e[N], w[N], h[N];
void add(int a, int b, int c)
{
e[idx] = b; w[b] = c; en[idx] = h[a]; h[a] = idx++;
}
bool spfa()
{
queue
for(int i = 0;i < n; i++)
{
q.push(i);
str[i] = true;
}
while (q.size())
{
int t = q.front();
q.pop();cn[0]=0;
for (int i = h[t]; i != -1; i = en[i])
{
int j = e[i];
if(dist[j]>dist[t]+w[i])
{
dist[j] = min(dist[j], dist[t] + w[j]);
cnt[j] = cnt[j-1]+1;if( cnt[j] >= n)return true;
if(!str[j])
{
str[j] = true;
q.push(dist[j]);
}
}
}return fales;
}
}
int main()
{
memset(g, 0x3f, sizeof g);
}
————————————————
版权声明:本文为CSDN博主「ikarty」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/ikarty/article/details/132782232