CF1720D1.Xor-Subsequence (easy version)
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
It is the easy version of the problem. The only difference is that in this version ai≤200 .
You are given an array of n integers a0,a1,a2,…an−1 . Bryap wants to find the longest beautiful subsequence in the array.
An array b=[b0,b1,…,bm−1] , where 0≤b0<b1<…<bm−1<n , is a subsequence of length m of the array a .
Subsequence b=[b0,b1,…,bm−1] of length m is called beautiful, if the following condition holds:
- For any p ( 0≤p<m−1 ) holds: abp⊕bp+1<abp+1⊕bp .
Here a⊕b denotes the bitwise XOR of a and b . For example, 2⊕4=6 and 3⊕1=2 .
Bryap is a simple person so he only wants to know the length of the longest such subsequence. Help Bryap and find the answer to his question.
输入格式
The first line contains a single integer t ( 1≤t≤105 ) — the number of test cases. The description of the test cases follows.
The first line of each test case contains a single integer n ( 2≤n≤3⋅105 ) — the length of the array.
The second line of each test case contains n integers a0,a1,...,an−1 ( 0≤ai≤200 ) — the elements of the array.
It is guaranteed that the sum of n over all test cases does not exceed 3⋅105 .
输出格式
For each test case print a single integer — the length of the longest beautiful subsequence.
输入输出样例
输入#1
3 2 1 2 5 5 2 4 3 1 10 3 8 8 2 9 1 6 2 8 3
输出#1
2 3 6
说明/提示
In the first test case, we can pick the whole array as a beautiful subsequence because 1⊕1<2⊕0 .
In the second test case, we can pick elements with indexes 1 , 2 and 4 (in 0 -indexation). For this elements holds: 2⊕2<4⊕1 and 4⊕4<1⊕2 .