Given an array with n integers (a1, a2, ..., an). You need to divide it into m consecutive subarrays,

which indicates that each element should be assigned to exact one subarray. Try to maximize the following formulations:

What is the maximum value you can achieve?

S(i) indicates the index of subarray that ai
belongs to. (Subarrays are counted starting from 1 to m
and from left to right.)

What is the maximum value you can achieve?