Lord_David's blog

By Lord_David, history, 3 years 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

| Write comment?
»
3 years 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)$$$.