#include using namespace std; typedef pair PII; typedef long long LL; typedef unsigned long long ULL; template inline bool amax (T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template inline bool amin (T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; } template ostream& operator << (ostream &os, const vector &v) { os << "["; for (typename vector::const_iterator it = v.begin(); it != v.end(); it++) { os << (it != v.begin() ? ", " : "") << *it; } os << "]"; return os; } template ostream& operator << (ostream &os, const set &s) { os << "["; for (typename set::const_iterator it = s.begin(); it != s.end(); it++) { os << (it != s.begin() ? ", " : "") << *it; } os << "]"; return os; } template ostream& operator << (ostream &os, const map &m) { os << "{"; for (typename map::const_iterator it = m.begin(); it != m.end(); it++) { os << (it != m.begin() ? ", " : "") << it->first << ":" << it->second; } os << "}"; return os; } template ostream& operator << (ostream &os, const pair &p) { os << "(" << p.first << ", " << p.second << ")"; return os; } template inline Target lexical_cast (const Source &s) { Target t; stringstream ss; ss << s; ss >> t; return t; } //> v < ^ (clock wise) int dx[] = {1,0,-1,0}; int dy[] = {0,1,0,-1}; const int INFI = 1<<28; const long long int INFL = 1LL<<60; const double INFD = 1e+300; const float INFF = 1e+100; const double EPS = 1e-8; int main(){ cout.setf(ios::fixed); cout.precision(10); ios_base::sync_with_stdio(false); LL T; cin >> T; while (T--) { LL n; cin >> n; vector a(n); for (LL i = 0; i < n; i++) cin >> a[i]; vector > dp1(110, vector(110, INFI)); dp1[0][0] = 0; for (LL i = 0; i < n; i++) { for (LL j = 0; j < i; j++) { for (LL k = 0; k < n; k++) { if (dp1[j][k] != INFI && dp1[j][k] < a[i]-a[j]) { cout << "dp1 " << i << " " << j << endl; dp1[i][k+1] = min(dp1[i][k+1], a[i]-a[j]); } } } } reverse(a.begin(), a.end()); vector > dp2(110, vector(110, INFI)); dp2[0][0] = 0; for (LL i = 0; i < n; i++) { for (LL j = 0; j < i; j++) { for (LL k = 0; k < n; k++) { if (dp2[j][k] != INFI && dp2[j][k] < a[i]-a[j]) { cout << "dp2 " << i << " " << j << endl; dp2[i][k+1] = min(dp2[i][k+1], a[i]-a[j]); } } } } reverse(a.begin(), a.end()); LL ans = 0; for (LL i = 0; i < n; i++) { LL tmp1 = 0; LL tmp2 = 0; for (LL j = n-1; j >= 0; j--) if (dp1[i][j] != INFI) { tmp1 += j; break; } for (LL j = n-1; j >= 0; j--) if (dp2[n-i-1][j] != INFI) { tmp2 += j; break; } LL tmp = tmp1 + tmp2; if (ans < tmp) { cout << i << " " << a[i] << " " << tmp1 << " " << tmp2 << endl; } ans = max(ans, tmp); } cout << ans+1 << endl; } return 0; }