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

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

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

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

»
9 лет назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

UPDATE : i tried optimizing even more but still MLE

here's current submission

»
9 лет назад, # |
  Проголосовать: нравится +11 Проголосовать: не нравится

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

  • »
    »
    9 лет назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

    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