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