Hello there
I'm trying to solve this problem D div1 from round 345
if you haven't read it it's about finding LIS for each query where each query we change the value of a number independently
doing just like the editorial said and using persistent segment trees i keep getting MLE
i tried optimizing the memory usage but no use
if anyone could find the reason for memory leak it would be really awesome
here's the code
UPDATE : i tried optimizing even more but still MLE
here's current submission
i think this line
is causing problems cuz you are allocating a lot of local space inside a function ... try to decompose the pairs into three global arrays allocated at compile time ( and use a comparer for sorting) maybe this will help
in my latest submission in the comment above i already adressed this issue
if you don't mind checking out that code it would be really great