Help in Maximum special array sum

Link of the problem - MAXSPSUM Problem - CodeChef