showvike's blog

By showvike, history, 4 years ago, In English

see this: https://codeforces.com/problemset/problem/1285/B

i understood the problem but could not identify how to solve it.. i read the editorial btw don't understood.. please give me a proper idea.. :(

  • Vote: I like it
  • -9
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
  Vote: I like it +3 Vote: I do not like it

In this problem, you have to basically find the largest sum continuous subarray. This can be done using Kadane's algorithm.
Note that you cannot use the entire array. Hence, the only way to maximize the max subarray sum is by choosing the max sum among subarrays $$$[1, n-1]$$$ and $$$[2,n]$$$. The max of them is the maximum obtainable sum. If the max obtainable sum is greater that the sum of all elements of the array, (Yasheer's choice), then you print "No" else you print "yes".