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
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)$$$.