Problem: https://codeforces.com/problemset/problem/660/F
I have a doubt.
So the answer of the problem will be like,
maximum subarray sum=pre[x]-pre[i] - (sum[x]-sum[i])*i
and if the subarrays limits (i,x] where x is in range [0,n-1]
So, in this problem we are applying convex hull tricks otherwise it’ll take O(n^2) time complexity. And to apply the convex hull tricks, we need to form first a line intercepts equation y=mx+c from the relation pre[x]-pre[i] - (sum[x]-sum[i])*i
And I didn’t understand, how Sanyam Bhaiya made the line intercept form from the maximum subarray sum relation so I need help.