QOJ.ac

QOJ

Süre Sınırı: 3.0 s Bellek Sınırı: 256 MB Toplam puan: 100 Hack'lenebilir ✓

#14426. 网格问题

İstatistikler

Yotsugi 正在玩一个高度为 $h$、宽度为 $w$ 的网格 $A$,该网格最初全部填满零,她按某种顺序对其执行以下 2 种操作:

  • 选择值 $i, j$($0 \le i \le h - 1, 0 \le j \le w - 1$)以及符号 $+$ 或 $-$,并将 $A_{i,j}, A_{i,j+1}, A_{i+1,j}, A_{i+1,j+1}$ 的值相应地修改为 $A_{i,j} \pm 2, A_{i,j+1} \pm 1, A_{i+1,j} \pm 1, A_{i+1,j+1} \pm 2$,其中 $\pm$ 被替换为所选的符号。在这里,Yotsugi 认为 $A_{h,j}$ 等价于 $A_{0,j}$,$A_{i,w}$ 等价于 $A_{i,0}$。换句话说,她将网格视为一个环面(torus)。
  • 选择值 $i, j$($0 \le i \le h - 1, 0 \le j \le w - 1$)以及符号 $+$ 或 $-$,并将 $A_{i,j}, A_{i,j+1}, A_{i,j+2}, A_{i+1,j}, A_{i+1,j+1}, A_{i+1,j+2}, A_{i+2,j}, A_{i+2,j+1}, A_{i+2,j+2}$ 的值相应地修改为 $A_{i,j} \pm 2, A_{i,j+1} \pm 5, A_{i,j+2} \pm 2, A_{i+1,j} \pm 5, A_{i+1,j+1} \pm 5, A_{i+1,j+2} \pm 5, A_{i+2,j} \pm 2, A_{i+2,j+1} \pm 5, A_{i+2,j+2} \pm 2$,其中 $\pm$ 被替换为所选的符号。与前一个操作相同,Yotsugi 将网格视为一个环面。

为了更容易理解这些操作,请参考说明部分。

第二天,网格被喷火蛞蝓吃掉了,现在 Yotsugi 想知道,如果她在完成所有操作后,所有值 $A_{i,j}$ 都位于 $[0, k]$ 内,她可能得到多少种不同的网格。注意,当 Yotsugi 执行操作时,值 $A_{i,j}$ 可以是负数或超过 $k$。由于答案可能很大,请帮她求出答案对 $10^9 + 9$ 取模后的结果。

输入格式

第一行包含 3 个整数 $h, w, k$($3 \le h, w \le 1\,000$,$1 \le k \le 10^9$)—— 网格的大小以及网格中可能的最大值。

输出格式

输出问题的答案对 $10^9 + 9$ 取模后的结果。

样例

输入格式 1

3 3 1

输出格式 1

2

输入格式 2

4 4 52

输出格式 2

972950693

输入格式 3

7 10 123

输出格式 3

93519598

说明

例如,如果我们有一个 $4 \times 4$ 的矩阵,我们可以按如下方式执行操作:

problem_14426_bdc5aaccf4f57ccf8e281b69a642fa5f.png

使用符号 $-$ 执行第一种操作。

problem_14426_c7868b974cacb61057c7998f75650c36.png

使用符号 $+$ 执行第二种操作。

problem_14426_bc6d6c6bdfd571cbf1363a33e2c0b200.png

使用符号 $+$ 执行第一种操作。

problem_14426_0aa751704d08e9f39b2346eade004eb7.png

使用符号 $+$ 执行第一种操作。

由于所有值都位于 $[0, 42]$ 内,因此这是第二个样例中要求你计数的矩阵之一。

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#364EditorialOpen题解jianglyView

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.