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
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
E. Paths and Trees time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving