Interesting Numbers

아직 제출이 없습니다시간 제한3초메모리 제한1024 MB

문제

The \textsl{bitwise exclusive or}, or simply XOR, is an operation denoted by $\oplus$ which works on two integers by XOR-ing their corresponding bits: if $x_i, y_i, z_i$ denote the $i$-th binary digit of $x$, $y$ and $z$, where $z = x \oplus y$, then $z_i = (x_i + y_i) \mod 2$.

You are given a positive integer $k$. A sequence of integers is \textsl{interesting} if XOR of any its two elements is less than or equal $k$.

Given a sequence $a_1, \dots, a_n$, determine the largest possible length of its interesting subsequence. (A subsequence is a sequence that can be derived from the given sequence by deleting zero or more elements.)

입력

The first line of input contains the number of test cases $z$ ($1 \leq z \leq 1\,000$). The descriptions of the test cases follow.

The first line of each case contains two integers $n$, $k$ ($1 \leq n \leq 30\,000$, $1 \leq k < 2^{20}$) -- the length of the sequence, and the upper bound on maximum XOR of its two elements.

The second line contains $n$ nonnegative integers $a_1, \dots a_n$ ($0 \leq a_i < 2^{20}$) -- the given sequence described above.

The sum of $n$ and $k$ over all test cases do not exceed $200\,000$ and $3\,200\,000$ respectively.

출력

For every test case output a single integer -- the maximum possible length of an interesting subsequence of the given sequence.

힌트

The elements $3$, $9$, $10$ and $3$ form an interesting subsequence, as XOR of every pair is not larger then $11$. For example $9 \oplus 10 = 1001_2 \oplus 1010_2 = 11_2 = 3 \leq 11$. There is no subsequence consisting of five elements with the same property, e.g. the sequence $(3,9,10,3,4)$ is not interesting because of $4 \oplus 9 = 100_2 \oplus 1001_2 = 1101_2 = 13 > 11$.