svg_af's blog

By svg_af, history, 8 years ago, In English

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

  • Vote: I like it
  • +1
  • Vote: I do not like it

»
8 years ago, # |
  Vote: I like it +5 Vote: I do not like it

UPDATE : i tried optimizing even more but still MLE

here's current submission

»
8 years ago, # |
  Vote: I like it +11 Vote: I do not like it

i think this line

145. pair<int, ii> comps[N];

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

  • »
    »
    8 years ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    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