相关链接
题目传送门: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)$
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
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
Some truly wonderful work on behalf of the owner of this internet site, dead great subject matter.
679247 131054Do you wear boxers or biefs? I wana bui em. 933157
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
687549 830591Yay google is my king assisted me to discover this outstanding internet site! . 191600
69082 951789Yay google is my king aided me to locate this great internet site ! . 297817
590172 531031Respect to author , some great information . 493118
149127 573096What is excellent respecting is dealing with instead of depending on. 861162
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
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
174695 627195Safest messages, or a toasts. are typically launched at one point during the wedding but are likely to just be hilarious, humorous to unusual as properly. best man jokes 383664
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!