摘要: ###1.dijkstra 时间复杂度:O(n^2) n次迭代,每次找到距离集合S最短的点 每次迭代要用找到的点t来更新其他点到S的最短距离。 #include<iostream> #include<algorithm> #include<cstring> using namespace std; 阅读全文
posted @ 2020-09-18 19:27 30天CF上蓝!!! 阅读(148) 评论(0) 推荐(0) 编辑
摘要: ###1.y氏写法 链式前向星注意事项,如果a->b,b->c在前向星中a的临点只有b,所以在求连通块的数量的时候不能一次dfs,要多次dfs! const int N=?,M=??;//N是点数,M是边数 int h[N],e[M],ne[M],idx; void add(int a,int b, 阅读全文
posted @ 2020-09-18 19:06 30天CF上蓝!!! 阅读(170) 评论(0) 推荐(0) 编辑