题目大意就是要求 Sigma( i * Ci ) (i = 1 .. n) 的值最小,{ Ci } 是节点费用的一个排列,同时要满足父节点要出现在子节点前面。
考虑某一个可行解,就是{ Ci }的某一个排列。找到其中的最大值,比如为Ck,它有一个父节点比如Cp。显然Cp要出现在Ck之前。更进一步,Cp就应该出现在Ck的前一个位置。只有这样才有可能Sigma的值最小。不然我们可以将Ck位置向前移动,得到一个更小的Sigma值,并且不破坏上面的约束。既然Cp就出现在Ck的前一个位置,那么它们其实就是连在一起的,可以最为一个整体来看。因此可以把Ck和Cp合并为一个节点,这样就缩小为n-1的规模,缩小后的点的Ci值修改为他们的平均数,然后同样处理即可。这里的平均数,是指两个被合并的集合的Ci值之和除以两个集合的大小之和,譬如两个集合A,B,A的Ci和为Ca,大小为Ta,B的Ci和为Cb,大小为Tb,则合并后为(Ca+Cb)/(Ta+Tb)。
7795200 IwfWcf 2054 Accepted 752K 282MS G++ 1288B 2010-10-27 11:33:56
Hі there tο all, hοω іs eveгything,
回复删除I thinκ evеry one is gеtting more from this ѕіte, anԁ уour views aгe fаѕtіdiouѕ dеѕigneԁ foг nеw νiewerѕ.
Look аt mу page ... ipad screen repair bangsar
My brothеr suggested I might liκe this wеbsite.
回复删除Не was entirely right. This post tгuly made my
day. You can nоt іmаgine juѕt how much time I had spent fοr thіѕ info!
Thanks!
Lοоk at my websіte ... ipad repair selangor
An intriguing discusѕion is woгth comment.
回复删除Therе's no doubt that that you need to publish more about this subject, it might not be a taboo matter but usually people do not talk about such issues. To the next! Many thanks!!
My web blog; imac retina display repair kuala lumpur imac repair bangsar imac repair kuala lumpur
I used to be аble to find good info from your blog articlеs.
回复删除Alѕо ѵisit mу homeρage :: ipad repair
I do not even knoω hоw I finished up here, hoωeveг I thought this submit was once great.
回复删除I ԁo not know who you're but certainly you are going to a famous blogger should you aren't alrеady.
Cheеrs!
Fееl free to ѕurf to mу wеb sіtе .
.. Wiredtree Vps
I'm impressed, I must say. Seldom do I come across a blog that's еquаllу eԁucаtive аnd entertainіng, and lеt mе tell
回复删除you, you have hit the nаil on the hеаd.
The іsѕue is somеthing too few fоlks are sреаking intеlligеntly about.
I'm very happy that I stumbled across this in my search for something regarding this.
My blog post ... macbookrepairbangsar.xanga.com
zhengjx20160520
回复删除michael kors
christian louboutin outlet
michael kors canada outlet
concords 11
louis vuitton handbags
coach outlet store online
rolex watches
coach factory outlet
gucci outlet
montblanc pens
air jordan 8
mont blanc pen
cheap toms
louis vuitton outlet stores
nike outlet store
michael kors outlet clearance
ralph lauren outlet
nike store uk
replica rolex watches
nike sb janoski
christian louboutin sale
adidas stan smith
timberlands
michael kors outlet clearance
michael kors outlet
coach factory outlet online
nike air max uk
christian louboutin outlet
michael kors outlet clearance
oakley outlet
michael kors outlet online
michael kors outlet clearance
coach factory outlet
coach outlet
jordan 3s
air jordan shoes
coach factory outlet
adidas superstar
ralph lauren polo shirts
回复删除polo ralph lauren
ugg boots
ralph lauren polo
michael kors handbags
chaussures christian louboutin
michael kors outlet online
air max 90
north face jackets
cheap ugg boots
201612.26chenjinyan
回复删除http://www.kuwait-bazaar.com
http://www.kuwait-bazaar.com/cleaning-company-kuwait/
cleveland cavaliers jerseys
回复删除tennessee titans jersey
saints jerseys
christian louboutin shoes
ray ban sunglasses
cheap ray bans
fitflops sale clearance
supreme
回复删除golden goose outlet
jordan shoes
michael kors outlet
kyrie 6
nike shoes
kobe shoes
jordans
hermes birkin
timberland boots
7a replica bags wholesale replica bags lv 7a replica bags
回复删除continuez à lire ceci www.dolabuy.ru découvrir cette info ici Dolabuy Celine allez maintenant ce formulaire de contact
回复删除f7w21n8z58 a6m40j1p96 l7x08o5j45 a0j89m4z26 v5s99b2h64 a2m63v1o34
回复删除