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

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

Hi everyone,

I’m working on a problem where my solution isn’t getting Accepted (AC), and I’m struggling to figure out why. The time limit is 3 seconds so ideally even n^2 should pass . As far as I think my code is somewhat around O(n+mlogm) . Problem Link

Looking for positive response :) submission id --> 299093047 My code

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

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

If I am not wrong. I think vector< vector<int> > p ( 2e5+2 ); is a bit slow. Creating and destryoying these many elements.

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

    Yes you are correct . It was an unnecessary overhead and I wasn't using most of the indexes just iterating without any need over them . I shifted to map to sort of create an adjacency list to solve this . Also I thought after each jump the powerup of sharky fades away. But no that wasn't the case . Once you consume a powerup jump power is increased and is persistent. Question should have specified this .MY AC CODE

    Tanks for your reply.