I am sorry for seeming desperate.. but that's because I am.. I haven't been able to sleep because of this problem.. Any help is much appreciated.. This is regarding the problem D of CF Round 1044.. "Chicken Jockey".. I don't need you to validate my code.. just let me know why my approach would be wrong.. Please read the question before moving forward.. thank you..
Question
My Approach
So what I'm trying to do is take a baseline value of the answer and store it in the sum.. the baseline value is what we would get if we keep killing the bottommost mob.. Now the actual answer can only be less than this.. how you may ask?? by breaking off mobs from the middle.. So now I create a new array "val" which stores how much I'd benefit if i killed the mob at that index.. I store this in negative so that I may add it to my baseline answer and reduce it.. So now obviously it's better to take as many negatives as possible.. except in the case where we have continuous negative values.. in that case what I do is I find the minimum subsequence sum of alternating elements..(there's only two.. so whatever the minimum value among those is.. that's what my "fun()" function is for) and then add it up to sum.. That's it.. that's my approach...
I have analysed the solution in the editorial.. I have tried to connect it to my solution.. It should be correct but I don't know what's wrong... It doesn't make any sense.. This never happens with me.. I am losing my mind.. Please help me stop losing my mind.. I might go crazy soon.. It's been days like this. Thank you.








