Is there anything special in improving treap performance?

Revision en1, by haleyk100198, 2017-10-15 08:33:17

Recently I am trying to solve 702F — T-shirts based on FatalEagle's approach described here. Somehow the runtime somehow blows up in some seemingly random cases, even after switching between different random priority genreation methods.

Here is my submission. As you can see the runtime of #12 and #16 suddenly blows up while other large cases only has a runtime less than 1second (Not to mention I barely passed #12 after switching from cin to scanf). I wonder if one of my helper functions have a larger time complexity than I anticipated (I think every treap function except pushres() is around O(lgn) ), or am I messing with pointers to much that it takes too much time to allocate space for my treap?

Tags treap, 702f

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English haleyk100198 2017-10-15 08:33:17 954 Initial revision (published)