Suppose that k is the maximum index such that ak≤0 then ak≤0<ak+1. Thus ak+1+⋯+a50=−(a1+a2+⋯+ak) and then
∣a1∣+∣a2∣+⋯+∣ak∣=∣a1+a2+⋯+ak∣=ak+1+ak+2+⋯+a50=2624=312.
We have
−312=a1+a2+⋯+ak≥k⋅a1⟹a1≤k−312,
312=ak+1+ak+2+⋯+a50≤(50−k)⋅a50⟹a50≥50−k312.
Hence,
a50−a1≥50−k312+k312=312(k1+50−k1)≥312⋅k+50−k4=25624.
The minimum value of S=25624, the equality case when
a1=a2=⋯=a25=−25312 and a26=a27=⋯=a50=25312.
We will continue with T. If there is some ak=0 then T=0. Now suppose that all of given numbers are non-zero and there are k negative numbers among a1,a2,…,a50. If k is odd then T<0. Thus to find the maximum value of T, we consider k is even. Put h=50−k. By AM-GM inequality, we have
T≤(ka1+a2+⋯+ak)k⋅(hak+1+ak+2+⋯+a50)h=(k312)k(h312)h=kkhh312h+k=kkhh31250.
We need to prove that
kk⋅hh≥2424⋅2626.
WLOG, k≤h then k≤h−2 since k,h are even. Suppose that k≤h−4 then we can use local modification to prove that
kk⋅hh>(k+1)k+1⋅(h−1)h−1⟺h⋅(1+h−11)h−1>(k+1)⋅(1+k1)k(∗)
Consider the function f(x)=(x+1)⋅(1+x1)x with x>1 and
g(x)=lnf(x)=ln(x+1)+x⋅ln(1+x1).
We have
g′(x)=1+x1+ln(1+x1)−1+x1=ln(1+x1)≥0.
Thus g(x) increasing and then (*) is proved. Therefore, the maximum value of T is 1324⋅1226. The equality case when
a1=a2=⋯=a24=−13, a25=a26=⋯=a50=12.