harbor run -t openthoughts/tasktrove-exp-rpt-taco-v2-taco-1838harbor download openthoughts/tasktrove-exp-rpt-taco-v2-taco-1838Yasser and Adel are at the shop buying cupcakes. There are ( n ) types of cupcakes arranged from ( 1 ) to ( n ) on the shelf, with infinitely many of each type available. Each cupcake of type ( i ) has a tastiness represented by an integer ( a_i ). Tastiness can be positive, zero, or negative.
Yasser wants to try them all and will buy exactly one cupcake of each type. On the other hand, Adel will choose a segment ([l, r]) (( 1 \leq l \leq r \leq n )) that does not include all cupcakes (he cannot choose ([l, r] = [1, n])) and will buy exactly one cupcake of each type in that segment.
After they finish shopping, they will compare the total tastiness of cupcakes they each bought. Yasser will be happy if the total tastiness of the cupcakes he buys is strictly greater than the total tastiness of the cupcakes Adel buys, regardless of which segment Adel chooses.
It is guaranteed that the sum of ( n ) over all test cases will not exceed ( 10^5 ).
For each test case, print "YES" if Yasser's total tastiness will always be strictly greater than Adel's total tastiness for any of his choices. Otherwise, print "NO".
3
4
1 2 3 4
3
7 4 -1
3
5 -5 5
YES
NO
NO
Implement the solution for the above problem in the /app/ directory.
Important: place your implementation at /app/solution.py so the verifier can run it.