
最小生成树
Shili_Xu
闽粤田头一村夫而已。
展开
-
UVA 10462 Is There A Second Way Left?(Kruskal算法/Prim算法)
【题意】 给一个含有n个点,cnt条边的图(1 【思路】 直接Kruskal算法求一下最小生成树,然后枚举这棵生成树中的边剔除来生成次小生成树。 【代码】 #include #include #include using namespace std; const int MAXN=105,INF=0x3f3f3f3f; struct edge{ int fro原创 2017-09-12 23:29:33 · 326 阅读 · 0 评论 -
Codeforces Round #446(Div.2)Problem E Envy(并查集)
E. Envy time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output For a connected undirected weighted graph G, MST (m原创 2017-12-06 01:14:39 · 315 阅读 · 0 评论