Блог пользователя hielitos

Автор hielitos, история, 5 лет назад, По-английски

Update: I got AC, i only changed the way of getting the elements to insert in the Treap, this code help me. So the problem is not the treap, is the priority queue, but i'm still wanna kown why Memory Limit .-.

Hi Codeforces, 5 month ago i asked for your help and meooow could solve my problem, thank you again for that :D.

Sadly, i have a new problem that i can't solve by myself. ( I'm still trying to solve it )

This time is with D1 and D2 problems from the last contest ( Codeforces Round #602 (Div. 2, based on Technocup 2020 Elimination Round 3 ).

I made a solution that i think it should pass both D1 and D2 problems but i'm getting Memory limit exceeded on test 10.

Here is my submission from D1 code. The difference from D2 are the lines 89-91 because of the limits ( I only did this because i didn't know what else to do :( ).

I think that my idea it's quite complicated to explain ( at least for me ), but i am working on it, maybe knowing what my code does someone would be able to help me..

But, as i can see i only do $$$N$$$ insertions to the Treap and $$$N$$$ insertions to an auxiliary priority queue, i don´t have idea why i´m getting memory limit.

I will appreciate any comment. Thank you :D

Полный текст и комментарии »

  • Проголосовать: нравится
  • -7
  • Проголосовать: не нравится

Автор hielitos, история, 5 лет назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • -3
  • Проголосовать: не нравится