#include #include #include using namespace std; int T,N; int A[100]; pairL[100],R[100]; main() { cin>>T; for(;T--;) { cin>>N; for(int i=0;i>A[i]; for(int i=0;ip; p.first=L[j].first+1; p.second=-(A[i]-A[j]); L[i]=max(L[i],p); } } } for(int i=N;i--;) { R[i]=make_pair(1,0); for(int j=N;--j>i;) { if(A[j]p; p.first=R[j].first+1; p.second=-(A[i]-A[j]); R[i]=max(R[i],p); } } } int ans=0; for(int i=0;i