QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 2048 MB Points totaux : 100

#2294. 尖端技术

Statistiques

近年来,各种 3D 对象的自动化制造在全球爱好者中已成为一种增长的趋势。你的朋友 Lewis 完全沉迷于这一趋势,他的车库里现在摆满了各种 3D 打印机和其他昂贵的机械设备。

他不断扩充的收藏中最新的一员是一台自动切割机。这台机器的工作原理是从最初形状为长方体的工件上切除材料。每一次切割都沿着一个平面穿过工件,并仅保留该平面一侧的材料。这意味着工件的最终形状必然是一个凸多面体。

Lewis 的机器的编程接口相当特殊。用户无需直接指定切割平面,而是输入一系列点,机器随后计算出切割平面,使得所有点都包含在最终形状内,且该形状的体积最小。形式上,它计算的是输入点的凸包。虽然这种设置在许多应用中非常方便,但它也有一定的局限性,因为机器只允许坐标使用 1 mm 的整数倍。

Lewis 想要使用他的机器为桌面游戏切割游戏棋子。他并不特别在意棋子的形状,但他要求它们具有特定的重量。工件的密度是恒定的,因此他只需要确保最终形状具有特定的体积。然而,由于机器的输入要求,这被证明是具有挑战性的。请帮助 Lewis 为他的切割机找到一个有效的输入。

输入格式

输入包含: * 一行,包含四个整数 $a, b, c$ 和 $v$ ($1 \le a, b, c \le 10^6, 1 \le v \le 6 \cdot a \cdot b \cdot c$),其中工件的尺寸为 $a \text{ mm} \times b \text{ mm} \times c \text{ mm}$,最终形状的体积必须恰好为 $\frac{v}{6} \text{ mm}^3$。

输出格式

输出一个整数 $n$ ($4 \le n \le 100$),随后输出 $n$ 个点来指定最终形状。每个点由三个整数 $x, y$ 和 $z$ ($0 \le x \le a, 0 \le y \le b, 0 \le z \le c$) 给出。形状随后被计算为这 $n$ 个点的凸包,其体积需要恰好为 $\frac{v}{6} \text{ mm}^3$。

如果存在多个有效解,你可以输出其中任意一个。保证解总是存在的。注意,允许输出重复的点。

样例

样例输入 1

1 1 1 1

样例输出 1

4
0 0 0
1 0 0
0 1 0
0 0 1

样例输入 2

3 1 2 7

样例输出 2

5
0 0 1
2 0 0
3 0 0
3 0 2
2 1 1

样例输入 3

2 2 2 25

样例输出 3

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