【BZOJ 2001】[HNOI2010] City 城市建设

相关链接

题目传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2001
神犇题解Ⅰ:http://www.cnblogs.com/BLADEVIL/p/3512644.html
神犇题解Ⅱ:http://blog.miskcoo.com/2015/04/bzoj-2001

解题报告

如果没有边权,只需要维护连通性
那么搞一个可以撤销的并查集就可以啦!

现在考虑带边权的情况,我们仍然对时间进行分治
在每一层,我们进行两个操作:

1. Contraction 缩小点的规模

将所有当前分治区间内会被修改的边的边权置为 $-INF$
然后做一遍MST,将此时通过非 $-INF$ 连接的点用并查集缩起来
因为$-INF$边只会有区间长度个,所以每一次分治后,点的规模不会超过分治区间的长度

2. Reduction 缩小边的规模

将会被修改的边的边权置为 $INF$,然后再做一遍MST
将此时不在MST中的边删去,因为保留的边数不会超过点数,所以边的规模也不会超过分治区间的长度

所以时间复杂度写出来长这样: $T(n) = 2T(\frac{n}{2}) + n\log n$
用主定理化简之后,时间复杂度就是: $O(n{\log ^2}n)$

13 thoughts to “【BZOJ 2001】[HNOI2010] City 城市建设”

  1. 460513 377403Soon after examine a couple of with the weblog posts on your web internet site now, and I really like your manner of blogging. I bookmarked it to my bookmark web site record and will probably be checking back soon. Pls take a look at my internet page as well and let me know what you feel. 638796

  2. 108229 15643This design is wicked! You most certainly know how to keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Great job. I really enjoyed what you had to say, and more than that, how you presented it. Too cool! 823224

  3. 931789 475810I discovered your weblog internet web site on google and check some of your early posts. Continue to maintain up the superb operate. I just further up your RSS feed to my MSN News Reader. Searching for forward to studying extra from you in a although! 876836

  4. 281610 265159Spot lets start function on this write-up, I really believe this wonderful internet site requirements additional consideration. Ill far more likely be once again you just read additional, thank you that info. 838169

  5. 512600 831592Typically the New york Weight Loss diet is certainly less expensive and flexible staying on your diet scheme intended for measures even so quick then duty keep a nutritious everyday life. weight loss 838527

  6. What i do not understood is actually how you are not really much more well-liked than you may be now. You’re very intelligent. You realize thus considerably relating to this subject, produced me personally consider it from a lot of varied angles. Its like men and women aren’t fascinated unless it’s one thing to accomplish with Lady gaga! Your own stuffs excellent. Always maintain it up!

Leave a Reply

Your email address will not be published. Required fields are marked *