Блог пользователя showvike

Автор showvike, история, 4 года назад, По-английски

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.. :(

  • Проголосовать: нравится
  • -9
  • Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

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".