#include #include #include #include #include #include #include #include #include #define repd(i,a,b) for (int i=(a);i<(b);i++) #define rep(i,n) repd(i,0,n) typedef long long ll; using namespace std; int inputValue(){ int a; cin >> a; return a; }; void inputArray(int * p, int a){ rep(i, a){ cin >> p[i]; } }; void inputVector(vector * p, int a){ rep(i, a){ int input; cin >> input; p -> push_back(input); } } template void output(T a, int precision) { if(precision > 0){ cout << setprecision(precision) << a << "\n"; } else{ cout << a << "\n"; } } int main(int argc, const char * argv[]) { // source code int T = inputValue(); rep(k, T){ int N = inputValue(); vector A(N); vector B(N); rep(i, N){ A[i] = inputValue(); B[N - i - 1] = A[i]; } // first: 最長系列の長さ second: 直前の差分 vector> up(N); vector> down(N); rep(i, N){ up[i].first = 1; down[i].first = 1; } up.front().second = 0; down.front().second = 0; repd(i, 1, N){ rep(j, i){ int fir = up[j].first + 1; int sec = A[i] - A[j]; if (fir >= up[i].first) { if (sec > up[j].second) { if (fir == up[i].first && sec > up[j].second) { continue; } up[i].first = fir; up[i].second = sec; } } } } repd(i, 1, N){ rep(j, i){ int fir = down[j].first + 1; int sec = B[i] - B[j]; if (fir >= down[i].first) { if (sec > down[j].second) { if (fir == down[i].first && sec > down[j].second) { continue; } down[i].first = fir; down[i].second = sec; } } } } rep(i, N){ up[i].first += down[N - 1 - i].first - 1; } int ret = -1; rep(i, N){ ret = max(ret, up[i].first); } output(ret, 0); } return 0; }