QOJ.ac

QOJ

时间限制: 2.0 s 内存限制: 1024 MB 总分: 100 可 Hack ✓

#9745. 递增序列

统计

给定一个长度为 $n$ 的非负整数序列 $a$ 和一个常数 $k$。 确定有多少个整数 $x \in [0, k]$,使得 $a_1 \oplus x, a_2 \oplus x, \dots, a_n \oplus x$ 构成一个非递减序列。 其中,$\oplus$ 表示异或运算。

输入格式

第一行包含一个正整数 $T$ ($1 \le T \le 2 \cdot 10^5$),表示测试用例的数量。 对于每个测试用例,第一行包含两个整数 $n, k$ ($1 \le n \le 2 \cdot 10^5, 0 \le k \le 10^{18}$)。 第二行包含 $n$ 个非负整数 $a_1, a_2, \dots, a_n$ ($0 \le a_i \le 10^{18}$)。 所有测试用例中 $n$ 的总和不超过 $2 \cdot 10^5$。

输出格式

对于每个测试用例,输出一行,包含一个整数,表示满足条件的整数 $x$ 的个数。

样例

输入 1

1
4 17
3 2 5 16

输出 1

4

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.