QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 256 MB 満点: 100

#5748. 行列式,或者……?

統計

给定一个数组 $a_0, a_1, \dots, a_{2^n-1}$。 考虑一个 $2^n \times 2^n$ 的矩阵 $A$,其中 $A_{ij} = a_{i|j}$,$i|j$ 表示数字 $i$ 和 $j$ 的按位或运算。 求矩阵 $A$ 的行列式。

输入格式

第一行包含一个整数 $n$ ($1 \le n \le 20$)。 第二行包含 $2^n$ 个整数 $a_0, a_1, \dots, a_{2^n-1}$ ($0 \le a_i < 10^9 + 9$)。

输出格式

输出一个整数,表示 $A$ 的行列式对 $10^9 + 9$ 取模的结果。

样例

输入 1

1
5 2

输出 1

6

输入 2

2
3 1 5 4

输出 2

999999997

输入 3

3
53 37 42 42 84 37 66 8

输出 3

47229676

说明

在第一个样例中,行列式为: $$\begin{vmatrix} a_0 & a_1 \\ a_1 & a_1 \end{vmatrix} = \begin{vmatrix} 5 & 2 \\ 2 & 2 \end{vmatrix} = 10 - 4 = 6$$

在第二个样例中,行列式为: $$\begin{vmatrix} 3 & 1 & 5 & 4 \\ 1 & 1 & 4 & 4 \\ 5 & 4 & 5 & 4 \\ 4 & 4 & 4 & 4 \end{vmatrix} = -12 \equiv 999999997 \pmod{10^9 + 9}$$

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.