博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
BZOJ 1601 [Usaco2008 Oct]灌水
阅读量:269 次
发布时间:2019-03-01

本文共 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/

你可能感兴趣的文章