QOJ.ac

QOJ

Límite de tiempo: 1.5 s Límite de memoria: 1024 MB Puntuación total: 100 Hackeable ✓

#15302. 切巧克力

Estadísticas

小 L 有一块大小为 $L \times W \times H$ 的巧克力。在巧克力内部有 $n$ 颗杏仁,其中第 $i$ 颗杏仁位于单位立方体 $[x_i - 1, x_i] \times [y_i - 1, y_i] \times [z_i - 1, z_i]$ 的中心。没有两颗杏仁占据相同的位置。

现在,小 L 想要将这块巧克力切成若干个更小的块。具体来说,他希望分别沿着三个维度进行 $p, q, r$ 次切割。每次切割都必须沿着整数坐标进行,在同一个维度上不能在相同的坐标处进行两次切割,且不能在巧克力的边界(即坐标为 $0$ 或 $L, W, H$ 处)进行切割。

形式化地,在 $x$ 方向上坐标为 $k$ ($0 < k < L$) 处进行一次切割,意味着沿着平面 $x = k$ 切开巧克力。对于 $y$ 和 $z$ 方向同理。

此外,在切割后得到的 $(p + 1)(q + 1)(r + 1)$ 块巧克力中,小 L 希望每块巧克力包含相同数量的杏仁。小 L 想知道有多少种本质不同的切割方法满足这一条件。如果存在某个维度上的某个位置,在第一种方法中进行了切割,而在第二种方法中没有,则认为这两种切割方法是不同的。输出结果模 $10^9 + 7$ 的值。

输入格式

每个测试用例的第一行包含三个整数 $L, W, H$ ($1 \le L, W, H \le 10^9$),表示巧克力的尺寸。

第二行包含三个整数 $p, q, r$ ($0 \le p, q, r \le 10^6$),分别表示在 $x, y, z$ 方向上的切割次数。

第三行包含一个整数 $n$ ($1 \le n \le 10^6$),表示杏仁的数量。

接下来的 $n$ 行,每行包含三个整数 $x_i, y_i, z_i$ ($1 \le x_i \le L, 1 \le y_i \le W, 1 \le z_i \le H$),表示一颗杏仁的位置。保证所有的三元组 $(x_i, y_i, z_i)$ 互不相同。

输出格式

输出单行,包含一个整数,表示满足条件的本质不同切割方法数模 $10^9 + 7$ 的值。

样例

输入样例 1

4 4 1
1 1 0
4
1 2 1
2 4 1
3 1 1
4 3 1

输出样例 1

1

输入样例 2

3 3 3
1 1 1
3
1 1 1
2 2 2
3 3 3

输出样例 2

0

输入样例 3

9 9 9
1 1 1
8
1 1 2
2 2 8
1 9 1
2 8 9
8 2 1
9 2 9
9 8 1
8 9 7

输出样例 3

180

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.