#Lutece3143. 二重之虹

二重之虹

Migrated from Lutece 3143 二重之虹

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

本题时间限制改为 300ms,请注意程序运行的常数因子

听说雨过天晴后会有双彩虹。

今后也请大家多多关注 Popipa


我们定义一个长为 nn 的序列 A={a1,a2,,an}A=\{a_1, a_2, \dots, a_n\} 是一个 rainbow 序列当且仅当 n2n\le 2,或者

$$\forall i=2, 3,\dots, n-1,\ a_i-a_{i-1}>a_{i+1}-a_i $$

现在有一个长度为 nn 的序列 R={r1,r2,,rn}R=\{r_1, r_2,\dots, r_n\},求出 RR 的所有满足是 rainbow 的子序列(即不必在 RR 中连续)长度的最大值。

Input

输入数据的第一行有一个数字 T (1T100)T\ (1\le T\le100),表示有 TT 组数据。

对于每组数据,第一行有一个数字 n (1n6000)n\ (1\le n\le6000),表示序列 RR 的长度,紧接着下一行有 nn 个由空格分割的数字 r1,r2,,rn (ri1012)r_1, r_2,\dots, r_n\ (|r_i|\le10^{12}),表示序列 RR

Output

对于每一组输入数据,输出一行一个整数,即序列 RR 的所有是 rainbow 的子序列长度的最大值。

Samples

2
5
1 2 3 4 5
5
1 2 3 2 1
3
4

Constraints

1T1001\le T\le100 1n60001\le n\le6000 ri1012|r_i|\le10^{12}

保证同一测试点中的 nn 的和不大于 60006000

Resources

2024 UESTC ICPC Training for Search and Dynamic Programming