Would like to know what is wrong with my solution for PLAYFIT

Here is the link to the problem.
Question: - PLAYFIT Problem - CodeChef

My Solution:-

What I did in this solution is that I am taking the maximum difference from the matches.
But in case of odd number of matches, the difference of the last two matches is taken separately, and then compared with the remaining matches.
I have run various test cases, the results are matching.
Thank you in advanced

I quickly went through the question and solution and it looks like you took consecutive difference but I think it’s not necessary. You can find difference between first match and 10th match which might give bigger results.

Sorry if Im wrong I didn’t go through the question properly