Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
!!!!!!!真心求教这道题目的算法!!!!!!我想到的是把图先用邻接表存起来,然后逐个将边删除,比如2,3之间的边删除, 然后用深度优先遍历2节点和3节点,分别得到节点数a1,a2,然后a1*a2就是这条边重复的次数 最后再将每条边的长度乘上重复的次数进行排序。 感觉超级麻烦,而且复杂度极高,做到一半就没办法写了,已经快4K了,我觉得肯定有更好的算法, 请大牛们介绍一下,谢谢!!! Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator