Educational Codeforces Round 119 Editorial
source link: http://codeforces.com/blog/entry/98061
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Idea: BledDest
1620B - Triangles on a Rectangle
Idea: BledDest
Idea: BledDest
Idea: adedalic
Idea: Neon
Idea: BledDest
22 hours ago, # |
In my opinion, I think that the positions of E and D should have been swapped.
22 hours ago, # |
In the problem E-Replace the Number, alternate solution mentions the small to large method. Can anyone explain how it has complexity of O(n log n)? Any resource added would also be helpful.
-
With small to large method you want to take the smaller set and add it the larger one. When you do this if you had an element in the smaller set, now it is, for sure, in a set with size at least twice the one beforehand. So you can move each element at most log(n) times since the set can't become more than the number of elements.
Here in the task you can keep them in vectors and if needed just swap the vectors after adding the smaller one to the larger.
Hope that explains it.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK