hdu2122 Ice_cream’s world III(MST)

网友投稿 273 2022-09-06

hdu2122 Ice_cream’s world III(MST)

Ice_cream’s world III

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1250    Accepted Submission(s): 413

Problem Description

ice_cream’s world becomes stronger and stronger; every road is built as undirected. The queen enjoys traveling around her world; the queen’s requirement is like II problem, beautifies the roads, by which there are some ways from every city to the capital. The project’s cost should be as less as better.

Input

Every case have two integers N and M (N<=1000, M<=10000) meaning N cities and M roads, the cities numbered 0…N-1, following N lines, each line contain three integers S, T and C, meaning S connected with T have a road will cost C.

Output

If Wiskey can’t satisfy the queen’s requirement, you must be output “impossible”, otherwise, print the minimum cost in this project. After every case print one blank.

Sample Input

2 1 0 1 10 4 0

Sample Output

10 impossible

Author

Wiskey

Source

​​HDU 2007-10 Programming Contest_WarmUp​​

Recommend

威士忌   |   We have carefully selected several similar problems for you:   ​​2121​​​  ​​​2119​​​  ​​​2129​​​  ​​​2118​​​  ​​​2117​​

​​Statistic​​ |

​​Submit​​ |

​​Discuss​​ |

​​Note​​

最小生成树 kruskal算法

#include #include #include using namespace std;struct node{ int a,b,cost;}c[10005];int fa[1005];void init(int n){ for(int i=0;i

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:这两人有望在东京奥运会开幕式代表运动员宣誓!
下一篇:世界杯冠亚军出局,瑞士、西班牙晋级欧洲杯8强!
相关文章

 发表评论

暂时没有评论,来抢沙发吧~