http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=3367 题目大意: 让你求最小生成树,并且按照字典序输出哪些点连接.无解输出-1 这里的字典序定义为:(不翻译啦~,详见我的比较函数) A solution A is a line of p integers: a1, a2, ...ap. Another solution B different from A is a line of q integers: b1, b2,…
Connect them ZOJ - 3204 You have n computers numbered from 1 to n and you want to connect them to make a small local area network (LAN). All connections are two-way (that is connecting computers i and j is the same as connecting computers j and i). T…
Connect them Time Limit: 1 Second Memory Limit: 32768 KB You have n computers numbered from 1 to n and you want to connect them to make a small local area network (LAN). All connections are two-way (that is connecting computers iand j is the sam…
最小生成树,我用的是并查集+贪心的写法. #include<stdio.h> #include<string.h> #include<math.h> #include<algorithm> using namespace std; ; int c[maxn][maxn]; int father[maxn]; int flag[maxn]; struct abc{ int fei, a, b; }dt[maxn*maxn]; struct ans{ int a…
Connect the Cities Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 3371 Description In 2100, since the sea level rise, most of the cities disappear. Though some survived cities are still connect…
Connect the Cities Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 13722 Accepted Submission(s): 3711 Problem Description In 2100, since the sea level rise, most of the cities disappear. Tho…