Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:(⊙_⊙)!my idea~

Posted by gbastc at 2011-08-04 22:04:30 on Problem 1236 and last updated at 2011-08-04 22:05:33
In Reply To:(⊙_⊙)?my idea Posted by:happynp at 2009-02-27 19:17:59
你前面的想法都是对的,最后的这个想复杂了,我看了你这个后纠结了一会儿,后来想通了。
其实,只要像前面想的只有一个弱连通分量就行了,因为就算有多个弱连通分量,其原则还是要先将出度为0和入度0的点先连通,
当其中较少的一方都被连通后,再将剩下的出度为0或入度为0的点任意连接就行了,还是max{Iz,Oz},感觉是个贪心

>    对于有多个弱连通分量的有向图,比如图G有Gx, Gy两个弱连通分量,其入度,出度为0的节点数分别为Ix,Ox和Iy,Oy. 不妨设Ox>=Iy,则考虑将Gx的Ox个出度为0的节点中的Iy个连到Gy的Iy个入度为0的节点上。这样就成了一个弱连通的有向图,它的入度,出度为0的节点数分别为Ix,Ox-Iy+Oy.则它的最少加边数为Iy+max{Ix,Ox-Iy+Oy},即为max{Ix+Iy,Ox+Oy}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator