#d2671. 优美的最长上升子序列
优美的最长上升子序列
Beautiful Longest Increasing Subsequence
Problem Description
There are multiple test cases.
For each case you are given an array of length . Choose an increasing subsequence from it whose indices (1-based) satisfy
where means divides ( is a divisor of ). Find the maximum possible length of such a subsequence.
Input Format
The first line contains an integer , the number of test cases that follow.
Each test case contains two lines: the first line contains an integer ; the next line contains integers, representing the array .
Output Format
For each test case, output one integer on a line, the length of the longest "beautiful" increasing subsequence that can be chosen.
Sample Input
4
4
1 4 6 7
2
2 2
10
1 2 3 4 5 6 7 8 9 10
10
10 9 8 6 5 2 3 1 2 1
Sample Output
3
1
4
1
Sample Explanation
- In the first case, a valid beautiful LIS is .
- In the third case, we may choose .
- In the fourth case, the longest beautiful LIS has length .
Constraints
- , and