一道裸的并查集,练练手不错. program CODEVS1073; var i,j,m,n,q,x,y,k1,k2,z:longint; f:..] of longint; function find(x:longint):longint; var fa:longint; begin while f[x]=x do exit(x); fa:=find(f[x]); f[x]:=fa; exit(fa); end; begin readln(n,m,q); to n do f[i]:=i; to…
Connect the Cities Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7338 Accepted Submission(s): 2093 Problem Description In 2100, since the sea level rise, most of the cities disappear. Thou…
还是畅通工程 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 20726 Accepted Submission(s): 9220 Problem Description 某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离.省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能…