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 |
问一下,这题的意思是求最小生成树使得树中最少个数颜色的个数最大吗?我的思路: 为三种颜色的边各建一个链表 用 Kruskal 算法,循环加不同颜色的边:红、绿、蓝、红、绿、蓝... 如果在加某个颜色的边时链表中当前边不是最小生成树的树边,找链表中下一个元素;如果链表到尾部了,算法中止 这样有问题吗? Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator