题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4009 题意:给出一个村庄(x,y,z).每个村庄可以挖井或者修建水渠从其他村庄得到水.挖井有一个代价,修水渠有一个代价.另外A村庄只能向其指定的一些村庄供水.使得所有村庄有水求最小代价. 思路:增加虚拟点0,向所有点连边表示挖井.能连边的连边.求最小树形图即可. struct point { int x,y,z; }; struct edge { int u,v,w; }; point p[N];…
Transfer water Time Limit:3000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4009 Description XiaoA lives in a village. Last year flood rained the village. So they decide to move the whole village to the moun…
开始学习最小树形图,模板题. Ice_cream’s world II Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) [Problem Description] After awarded lands to ACMers, the queen want to choose a city be her capital. This is an important event in…