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

建议使用的浏览器:

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

2595:Crowded Forest Wildlife

题目描述
The WWF volunteers are back again to collect more wildlife from Gump Forest! Animals have moved around the forest, and some trails are getting more crowded!. Lisa finds that the same type of animal may now be found living on multiple trails connected to the same clearing.
Elsewhere in the forest trails may have no animals living on it. If a trail has no animals, the WWF truck can drive along it any time without collecting any animals. Can Lisa still guide the WWF volunteers through the forest and fill up their truck?
输入解释
Animals are given as words(lowercases). Clearings are given as numbers. There may be up to 500 clearings. Clearing 0 is always the entrance to Gump Forest.
The input begins with the Gump Forest trail map. Each line describes a trail between two clearings as a pair of numbers, followed by a list of animals living on the trail. There are no more than 1000 trails and the number of animals on each trail will not exceed 30. Remaining lines begain with list of animals to be collected, in the order they are to be collected.
输出解释
For each list of animals to be collected, your program should output either ”Succeeded” if there is a path through the Gump Forest that can fill up the truck and return it to the entrance. Otherwise
your program should output ”Failed” for that list.
Hint: Don’t try to solve the problem in a brute-force manner by enumerating all possible paths through Gump Forest. (It will take too long.)
输入样例
1 3 puma
2 3 lynx
0 3 toad
0 1
0 2
puma lynx
lynx toad
puma lynx toad
1 0 puma
1 2 puma
2 0 puma
puma puma puma 
puma
输出样例
Succeeded
Succeeded
Failed
Succeeded
Failed
来自杭电HDUOJ的附加信息
Recommend lcy

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

源链接: HDU-2595

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

共提交 0

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