Issue with the MMSUM problem

I have made a solution which gives a WA
https://www.codechef.com/viewsolution/29880584

It runs on any random inputs i put in… So any suggestions regarding a testcase where it fails or the problem with the algorithm would be great.

Thanks.

2
6 
8 4 -7 9 -2 -4 
6
6 -4 10 10 -6 1 

I wasn’t able to fully understand your solution, so I can’t tell you what is wrong.
But it passed 98% of test cases

2 Likes

https://www.codechef.com/viewsolution/29884239
optimised the solution for both of your cases.
gives 21 and 23 respectively.

still WA.

It’s 21 & 26

1 Like

got an AC…thanx for the help