摘要:
https://www.acwing.com/problem/content/1145/ 思路 \(把已有的边加上,会形成各个连通块,等价于把每个连通块当成一个点去做Kruskal算法.\) #include <bits/stdc++.h> using namespace std; #define 阅读全文
摘要:
https://www.acwing.com/problem/content/1144/ #include <bits/stdc++.h> using namespace std; #define IO ios::sync_with_stdio(false);cin.tie(0); cout.tie 阅读全文
摘要:
https://www.acwing.com/problem/content/861/ \(裸题\) #include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N = 1000 阅读全文
摘要:
https://www.acwing.com/problem/content/1142/ \(一道裸题\) \(最小生成树有两种算法:Prim \ 和\ Kruskal.\) \(Prim:O(n^2)\) \(Kruskal:O(mlogm)\) \(如何证明算法正确(如何证明当前这条边一定可以被 阅读全文
摘要:
https://www.acwing.com/problem/content/346/ #include <bits/stdc++.h> using namespace std; #define IO ios::sync_with_stdio(false);cin.tie(0); cout.tie( 阅读全文
摘要:
https://www.acwing.com/problem/content/345/ #include <bits/stdc++.h> using namespace std; #define IO ios::sync_with_stdio(false);cin.tie(0); cout.tie( 阅读全文
摘要:
https://www.acwing.com/problem/content/1127/ #include <bits/stdc++.h> using namespace std; #define IO ios::sync_with_stdio(false);cin.tie(0); cout.tie 阅读全文
摘要:
https://www.acwing.com/problem/content/347 \(求从起点S到终点E恰好经过N条边(可以重复经过)的最短路.\) \(即求出原距离矩阵的N次方,可以用类似qmi()的方式优化.\) #include <bits/stdc++.h> using namespac 阅读全文