INOI Calvins Game, what is going wrong?

Here’s the problem:
https://www.codechef.com/IOIPRAC/problems/INOI1301

Here’s my solution:
https://www.codechef.com/viewsolution/12397702

It passes all the test cases except 2, and I am having quite a hard time figuring out where I went wrong.
I understand the other solutions(namely dp on 2 arrays or using the same array in different directions) but wanted to know what was wrong with this one.
I’d appreciate if someone could point the mistake out to me, or maybe give me a test case that the code fails.

Thanks

Hey you are missing out on the case where Calvin doesn’t make a move at all in the forward direction.

1 Like

Isn’t that the case where i = k? Is that wrong?
(btw, I’d have upvoted, but I don’t have enough reputation)

admin suspend this guy he is trying to advertise… There are many more like him

I swear, I ran out of flags reporting this guy!!

Guys, send a mail at bugs@codechef.com too, so that admins take an action!!!

check this test case.

50 30
-137 -582 -867 -821 -782 -64 -261 -120 -507 -779 -460 -483 -667 -388 -807 -214 -96 -499 -29 -914 -855 -399 -443 -622 -780 -785 -2 -712 -456 -272 -738 -821 -234 -605 -967 -104 -923 -325 -31 -22 -26 -665 -554 -9 -961 -902 -390 -702 -221 -992

answer: -6249

//