Jesse_Pinkman_bch's blog

By Jesse_Pinkman_bch, history, 16 months ago, In English

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

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    16 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    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.