ACM Contest and Blackout 题目链接:https://vjudge.net/problem/UVA-10600 Description: In order to prepare the “The First National ACM School Contest” (in 20??) the major of the city decided to provide all the schools with a reliable source of power. (The m…
[题意] n个点,m条边,求最小生成树的值和次小生成树的值. InputThe Input starts with the number of test cases, T (1 < T < 15) on a line. Then T test cases follow. Thefirst line of every test case contains two numbers, which are separated by a space, N (3 < N < 100)the n…
题目链接:https://vjudge.net/problem/UVA-10600 In order to prepare the “The First National ACM School Contest” (in 20??) the major of the city decided to provide all the schools with a reliable source of power. (The major is really afraid of blackoutsJ).…
The Unique MST Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 19941 Accepted: 6999 Description Given a connected undirected graph, tell if its minimum spanning tree is unique. Definition 1 (Spanning Tree): Consider a connected, undir…
题目链接:https://vjudge.net/problem/UVA-10462 Nasa, being the most talented programmer of his time, can’t think things to be so simple. Recently all his neighbors have decided to connect themselves over a network (actually all of them want to share a bro…
用prim算法求最小生成树和次小生成树~ #include<cstdio> #include<algorithm> #include<cstring> using namespace std; ; const int inf=1e9; int g[maxn][maxn],d[maxn],visit[maxn],pre[maxn],c[maxn][maxn],N,M; int path[maxn][maxn];//记录最小生成树里两点之间的路径 void init ()…
Qin Shi Huang's National Road System Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10874 Accepted Submission(s): 3846 Problem Description During the Warring States Period of ancient China(4…
The Unique MST Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 28673 Accepted: 10239 Description Given a connected undirected graph, tell if its minimum spanning tree is unique. Definition 1 (Spanning Tree): Consider a connected, undir…
Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 22335 Accepted: 7922 Description Given a connected undirected graph, tell if its minimum spanning tree is unique. Definition 1 (Spanning Tree): Consider a connected, undirected graph G =…