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

建议使用的浏览器:

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

5899:oasis in desert

题目描述
There are N oases connected by M roads in the desert,and each road is L km long.Now a traveler who can at most walk K km with his supplies.

We define two concept now:

1.The Biggest Dangerous Oasis List: For every pair of oases in the list,their minimum distance should be longer than K km.And the size of The Biggest Dangerous Oasis List is biggest among lists which meet the condition.

2.The Smallest Safe Oasis List:for every pair of oases in the desert,if their minimum distance is shorter than K km,the list should contain at least one of them .And the size of The Smallest Safe Oasis List is smallest among lists which meet the condition.

Now the traveler wants to get a list which is both The Biggest Dangerous Oasis List and The Smallest Safe Oasis List.
输入解释
There is a t in the first line,means k cases.In each case,there is firstly n (0<= n <= 500 ),m(0<=m<=n*(n-1)/2) and k(0<=k<=100000).Then m lines, each line input a,b(1<=a,b<=n),and l(0<=l<=100000),means there is a road which is l km long between a and b.
输出解释
for each case,firstly the size of the list,then print the oases in the list in increasing order,separated by spaces.
If there are multiple answers, print the lexicographically smallest one.
If there is no list, output "Impossible"
输入样例
1
6 7 30
1 2 40
1 3 20
1 4 30
2 3 15
5 3 20
5 6 20
3 6 50
输出样例
3
1 2 5
来自杭电HDUOJ的附加信息
Recommend wange2014

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

源链接: HDU-5899

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

共提交 0

通过率 --%
时间上限 内存上限
8000/4000MS(Java/Others) 65536/65536K(Java/Others)