QOJ.ac

QOJ

実行時間制限: 5 s メモリ制限: 524288 MB 満点: 100 ハック可能 ✓

#14029. 空间思维

統計

小 Vitechka 向小 Mitechka 吹嘘说他非常熟悉 $n$ 维空间。Mitechka 不相信他,并打赌 Vitechka 无法将一个 $n$ 维超立方体分割成若干个 $n$ 维单形(simplex)。在这里,单形是 $n$ 维空间中的一个几何体,它有 $(n + 1)$ 个顶点,且每个顶点都与超立方体的一个顶点重合。此外,单形的 $n$ 维体积不能为零。

为了确保 Vitechka 的分割是正确的,他们约定如下:Mitechka 在超立方体内部安排一个包含 $m$ 个点的列表;然后 Vitechka 构建一组单形,并为 Mitechka 列表中的每个点指定他所构建的集合中的某一个单形。之后,Mitechka 进行两项验证。第一:Vitechka 给出的单形的 $n$ 维体积之和必须等于超立方体的体积。第二:Mitechka 列表中的每个点都必须位于为该点指定的单形的内部或边界上。如果这两项测试都通过,Mitechka 就必须宣布 Vitechka 获胜。

他们达成了协议。但开始任务后,Vitechka 意识到自己高估了自己的能力。现在他需要你的帮助。

超立方体由不等式组 $0 \le x_i \le 1$ 定义。

输入格式

第一行包含两个整数 $n$ 和 $m$($2 \le n \le 8$,$0 \le m \le 10^5$)。

接下来的 $m$ 行,每行包含 $n$ 个数,表示点的坐标。所有坐标均为 $0$ 到 $1$ 之间的实数,且小数点后最多有五位数字。

输出格式

第一行,输出单形的数量 $t$。

接下来的 $t$ 行,每行输出 $n \cdot (n+1)$ 个数。第 $(k+1)$ 行中的第 $(n \cdot (j - 1) + i)$ 个数必须是第 $k$ 个单形的第 $j$ 个顶点的第 $i$ 维坐标。每个坐标必须等于 $0$ 或 $1$。

在此之后,输出 $m$ 行。第 $(i + t + 1)$ 行输出包含第 $i$ 个点的单形编号(单形编号从 $1$ 到 $t$)。

如果单形的体积之和等于 $1$,且给定的 $m$ 个点中的每一个都位于其对应指定的单形内部或边界上,则认为答案是正确的。

样例

输入样例 1

2 3
0 1
0.5 0.5
1 0

输出样例 1

2
0 0 0 1 1 1
0 0 1 0 1 1
1
1
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.