Please give me the answer such that time complexity is O(N^2logN) or less.
Given an array A with length N, and S=0, ans=0. For i in range(0,n), we can choose "S+=A_i" or "ans+=S". Then how to maximize ans?
Constraints: A_i > 0 (for all i), N<=2000.
I think this problem might be solved with DP, but I cannot do that.