They tell you it is impossible, but what about 1,1,1,1,1,1,-7,1,1,1,1,1,1 13 terms?
If this were an infinite sequence, then every 11 is positive while every 7 is negative would mean that every set of 4 is positive.
so if S(Tn,Tn+1,Tn+2,Tn+3) is positive, and S(Tn,...,Tn+6) is negative then S(Tn+4,Tn+5,Tn+6) is negative but S(Tn+4,...,Tn+7) is positive because it is four numbers.
thus Tn+7 is positive and we have a contradiction for an infinite sequence.
So to find the max value we have to see where this reasoning breaks down.
At 17 terms, we can say that all sequences of 4 are positive
S1-4 = S1-11 - S5-11,
S7-10 = S7-17-S11-17
S8-11=S1-11-S1-7
S14-17=S7-17-S7-13
thus all sequences of 3 are negative and all numbers must be positive a contradiction.
so max is at most 16 and at least 13
for 16 5,5,-13,5,5,5,-13,5,5,-13,5,5,5,-13,5,5
fits the bill
Derived as follows
we can show every sequence of length 4 is positive except 7-10
because it is the difference of a positive sequence of 11 minus negative sequence of 7
sequences of length 3 known to be negative are then
123 =1-7-4567 234=2-8-5678 345=3-9-6789
567=5-11-891011 678=6-12-9101112 789=7-13-10111213
8910=8-14 - 11-14 91011=9-15 - 12-15
101112 10-16 - 13-16 121314=8-14 - 8-11 131415=9-15 - 9-12 141516=10-16 - 10-13
all but 456 and 11 12 13
then the following are known to be positive, as the difference of a shown positive sequence of 4 and a known negative sequence of 3
1,2,4,5,6,8,9,11,12,13,15,16
for example 1= (1234)-(234)= ((1-11)-(5-11))-((2-8)-(5-8))
= [(1-11)-(5-11)]-[(2-8)-[(5-15)-(9-15)]]
if a,a,-b,a,a,a,-b,a,a,-b,a,a,a,-b,a,a
2a+b<0
3a+b>0
b<-2a b>-3a
5a+2b <0
b<-5/2a
8a+3b>0
b>-8/3a