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

建议使用的浏览器:

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

2480:Steal the Treasure

题目描述
The alliance of thieves decides to steal the treasure from country A. There are n cities in country A. Cities are connected by directional or bidirectional road. To avoid the risk, the king of country A divides his treasure and hides them in some place on the road.
  The alliance has found out the secret of the king. They get a map of country A which shows the location and the quantity of treasure on each road. In order to make the maximum profit and reduce the least loss, the alliance determines to send n thieves respectively to each city (one city one thief). At the appointed time, each thief chooses one road (if there is a road and notice that the road may have direction) to get to its corresponding city. Then he can steal the treasure on that road. After stealing, all the thieves return back to their base immediately.
  The heads of the alliance wonder to know the quantity of the treasure they can steal at most.
输入解释
There are multiple cases. Input is terminated by EOF.
  For each case, the first line contains two integers n (1<=n<=1000) and m (0<=m<=n*(n-1)/2), representing the number of cities and the number of roads in country A. The following m lines, each line contains four integers x, y (1<=x, y<=n, x≠y), d (0<=d<=1), w (0<=w<=1000), which means that there is a road from city x to city y, d=0 shows this road is bidirectional and d=1 shows it is directional and x the starting point, w is the quantity of treasure on the road.
  We guarantee that the road (x, y) and (y, x) will never appear together in the same case.
输出解释
For each case, output the maximum quantity of treasure the alliance can get.
输入样例
2 1
1 2 0 10
5 5
1 2 1 0
1 3 1 10
2 3 0 20
3 4 0 30
4 2 1 40
输出样例
10
100
来自杭电HDUOJ的附加信息
Recommend lcy

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

源链接: HDU-2480

最后修改于 2020-10-25T22:53:51+00:00 由爬虫自动更新

共提交 0

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