QOJ.ac

QOJ

Limite de temps : 1.0 s Limite de mémoire : 256 MB Points totaux : 100 Hackable ✓

#10823. 伪沃尔什变换

Statistiques

有一个整数集合 $\{0, 1, 2, \dots, 2^m - 1\}$。现在你需要从中选择 $k$ 个整数。每个整数最多只能被选择一次。设你选择的整数为 $a_1, a_2, \dots, a_k$。你需要确保 $a_1 \oplus a_2 \oplus \dots \oplus a_k = n$,其中 $\oplus$ 表示按位异或运算。

你希望使 $k$ 尽可能大。请计算最大的 $k$。

输入格式

第一行包含一个整数 $T$ ($1 \le T \le 10^4$),表示测试用例的数量。

对于每个测试用例,唯一的一行包含两个整数 $m$ 和 $n$ ($1 \le m \le 60, 0 \le n < 2^m$)。

输出格式

对于每个测试用例,输出一行一个整数,表示最大的 $k$。

样例

样例输入 1

1
2 2

样例输出 1

3

说明

例如,我们可以从集合中选择 $\{0, 1, 3\}$,因为 $0 \oplus 1 \oplus 3 = 2$。

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.