Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether there really is a way from the place his customer has build his giant steel crane to the place
1.dijkstra 时间复杂度:O(n^2) n次迭代,每次找到距离集合S最短的点 每次迭代要用找到的点t来更新其他点到S的最短距离. #include<iostream> #include<algorithm> #include<cstring> using namespace std; const int N=510; int g[N][N]; int dis[N],n,m;//dis[i]表示节点i到初始点的最短距离 bool st[N]; int dijkst