Lord_David's blog

By Lord_David, history, 5 weeks ago, In English

Hello everyone, I've spent a lot of time trying to solve this problem 1574C - Slay the Dragon, I've even read the editorial and tried implementing it myself, but every time it's too slow no matter what I try. So could someone please explain why this solution is too slow. Thanks in advance! 129796109

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

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

You should pass your vector to a function by reference (like this: vl &nums), otherwise you'll be creating an independent copy of it, making your code work in $$$O(n \cdot m)$$$.

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    OMG THANK YOU SO MUCH!!!!!!!! <3 orz. I didn't think about that