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).…
用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 ()…
The Best Seat in ACM Contest Time Limit: 1000MS Memory limit: 65536K 题目描述 Cainiao is a university student who loves ACM contest very much. It is a festival for him once when he attends ACM Asia Regional Contest because he always can find some famous…