Bob was given an array A consists of N elements.Alice is so clever, she immediately claim that The max sum of consecutive elements is X.(Don’t guarantee it’s correct).
Bob is tricky, he secretly flip one number from x to -x, and say “You are wrong, the max sum is Y”. Now you task is to check whether there is a way to flip one number and make Y > X.
Notice that if all elements are non-positive, the max sum of consecutive elements is 0.
The input contains several test cases.
Each test case contains two positive integers N, X;
The next line contains N integers represent the array A.
(0 < N ≤ 20000) (-1e9 ≤ A_i ≤ 1e9) (0 ≤ X ≤ 1e18)
if there is a way to make Y > X, print “YES” ,otherwise print “NO”.
5 5 1 -2 3 -4 5 5 100 1 -2 -3 -4 -5
YES NO
Bob can flip -4 to 4, and now the max sum is 3+4+5;
There is another way, He can also flip -2, to make 1+2+3 > 5;