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…
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 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…
John's trip Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8641 Accepted: 2893 Special Judge Description Little Johnny has got a new car. He decided to drive around the town to visit his friends. Johnny wanted to visit all his frien…
The order of a Tree Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2070 Accepted Submission(s): 1097 Problem Description As we know,the shape of a binary search tree is greatly related to the ord…