Please, try EDU on Codeforces! New educational section with videos, subtitles, texts, and problems. ×

Help with Treap

Revision en1, by hielitos, 2019-06-21 03:51:48

Hi, my question is related with Treaps, and maybe random numbers.

I was trying to solve this problem: C2. Exam in BerSU (hard version), but during the contest I made this solution with Treap: My code and i got TLE.

Then I read the problem again and I solved it based on the limit for the time t_i

And after the contest I asked if somebody had solve this problem with treap and the answer was yes and this is the code Solution with treap

Now, I am asking to myself if my code doesn't work because of the way I use the random number generator (maybe the treap is unbalanced or i don't know) or my implementation of the treap is wrong.

I have no idea why my solution doesn't work

Any help will be appreciate. Thanks in advance and please feel free to asked about any part of my code. Here is the discussion after the contest: Here , The blog about the random generator I use and The referenced I used to code my treap

Tags treap, treaps, #help


  Rev. Lang. By When Δ Comment
en1 English hielitos 2019-06-21 03:51:48 1284 Initial revision (published)