这是无向图的
void Floyd() { memset(v, 0x3f, sizeof v); for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++) v[i][j] = map[i][j]; for(int k = 1; k <= n; k++) for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++) v[i][j] = v[j][i] =min(v[i][j], v[i][k]+v[k][j]); }
时间: 2024-11-08 21:51:37