本文共 530 字,大约阅读时间需要 1 分钟。
在一块土地上建造水库,相当于从一个有水的0号水库引水,做一遍最小生成树即可。
#include#include int read(){ int x=0,f=1; char ch=getchar(); while((ch<'0')||(ch>'9')) { if(ch=='-') { f=-f; } ch=getchar(); } while((ch>='0')&&(ch<='9')) { x=x*10+ch-'0'; ch=getchar(); } return x*f;}const int maxn=300;const int maxm=50000;struct edge{ int x,y,l; edge(int _x=0,int _y=0,int _l=0):x(_x),y(_y),l(_l){ } bool operator <(const edge &other) const { return l
转载地址:http://rbwo.baihongyu.com/