1202.
oasis in desert
时间限制 4000 ms
内存限制 66 MB
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.
输入数据
输出数据
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
\n
· · \n
· · \n
· · \n
· · \n
· · \n
· · \n
· · \n
· · \n