当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3311:Dig The Wells

题目描述
You may all know the famous story “Three monks”. Recently they find some places around their temples can been used to dig some wells. It will help them save a lot of time. But to dig the well or build the road to transport the water will cost money. They do not want to cost too much money. Now they want you to find a cheapest plan.
输入解释
There are several test cases.
Each test case will starts with three numbers n , m, and p in one line, n stands for the number of monks and m stands for the number of places that can been used, p stands for the number of roads between these places. The places the monks stay is signed from 1 to n then the other m places are signed as n + 1 to n + m. (1 <= n <= 5, 0 <= m <= 1000, 0 <=p <= 5000)
Then n + m numbers followed which stands for the value of digging a well in the ith place.
Then p lines followed. Each line will contains three numbers a, b, and c. means build a road between a and b will cost c.
输出解释
For each case, output the minimum result you can get in one line.
输入样例
3 1 3
1 2 3 4
1 4 2
2 4 2
3 4 4 
4 1 4
5 5 5 5 1
1 5 1
2 5 1
3 5 1
4 5 1
输出样例
6
5
来自杭电HDUOJ的附加信息
Author dandelion
Recommend wxl

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3311

最后修改于 2020-10-25T23:02:14+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
6000/2000MS(Java/Others) 65536/32768K(Java/Others)