QOJ.ac

QOJ

Límite de tiempo: 2 s Límite de memoria: 512 MB Puntuación total: 100

#2611. Trans

Estadísticas

Bob 对 popcount 和一些奇怪的变换很感兴趣。目前,他正在攻克以下问题:

给定一个包含 $2^n$ 个整数的数组 $a_0, a_1, a_2, \dots, a_{2^n-1}$。任务是对于每个 $i$ ($0 \le i \le 2^n - 1$),计算:

$$b_i = \sum_{j=0}^{2^n-1} (\text{popcount}(i \text{ and } j) \bmod 2) \cdot a_j$$

其中 “$\text{popcount}(x)$” 表示 $x$ 的二进制表示中 1 的个数,“and” 表示按位与运算。

尽管 Bob 非常聪明,但他仍然无法快速解决这个问题。你能帮他计算出所有的 $b_i$ 吗?

输入格式

第一行包含一个整数 $n$ ($1 \le n \le 20$)。

第二行包含 $2^n$ 个整数,描述数组 $a$ ($1 \le a_i \le 10^9$)。

输出格式

输出一行,包含 $2^n$ 个整数,其中第 $i$ 个整数为 $b_i$ 的值。

样例

输入 1

2
1 2 3 4

输出 1

0 6 7 5

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.