QOJ.ac

QOJ

Limite de temps : 2.0 s Limite de mémoire : 512 MB Points totaux : 100

#11804. 宇宙飞船

Statistiques

你正在驾驶一艘三维空间中的宇宙飞船。

你的飞船当前位于点 $(x_1, y_1, z_1)$,正朝着方向 $(vx_1, vy_1, vz_1)$ 飞行。你的目标是到达点 $(x_2, y_2, z_2)$,并以方向 $(vx_2, vy_2, vz_2)$ 飞行。你的飞船只能沿直线或半径至少为 $r_0$ 的圆弧飞行。在飞行轨迹的两个片段之间切换时(无论是直线与圆弧、圆弧与直线、两个不同的圆弧,还是两个不同的直线——尽管后者毫无意义),拐点处的方向必须保持一致(所有方向向量均在正标量乘法意义下给出,因此方向 $(1, 1, 1)$ 和 $(2, 2, 2)$ 是相同的,但 $(1, 1, 1)$ 和 $(-1, -1, -1)$ 是不同的)。

你需要找到满足上述条件的任意轨迹。注意,轨迹不需要是最短的,只需符合输出格式部分描述的相对宽松的限制即可。

输入格式

第一行包含三个整数 $x_1, y_1, z_1$ ($-10 \le x_1, y_1, z_1 \le 10$)。 第二行包含三个整数 $vx_1, vy_1, vz_1$ ($-10 \le vx_1, vy_1, vz_1 \le 10$,且至少有一个不为零)。 第三行包含三个浮点数 $x_2, y_2, z_2$ ($-10 \le x_2, y_2, z_2 \le 10$)。 第四行包含三个浮点数 $vx_2, vy_2, vz_2$ ($-10 \le vx_2, vy_2, vz_2 \le 10$,且至少有一个不为零)。 第五行包含一个整数 $r_0$ ($1 \le r_0 \le 10$)。

输出格式

在输出的第一行,打印轨迹中的片段数量 $n$ ($0 \le n \le 100$)。在接下来的 $n$ 行中,打印每个片段的描述。

对于每个片段,如果是直线段,先打印 $1$,如果是圆弧段,则打印 $2$,随后紧跟该片段终点的浮点坐标(起始点取自前一个片段的终点,对于第一个片段则取自初始起点)。对于圆弧段,还需额外打印圆心的浮点坐标。

你输出的所有坐标绝对值不得超过 $1000$。评测程序将至少使用 double 浮点精度进行所有计算。对于每个拐点,评测程序将检查两个片段方向之间的夹角是否不超过 $10^{-6}$。评测程序还将检查终点距离目标终点是否不超过 $10^{-6}$,起始方向与目标起始方向的夹角是否不超过 $10^{-6}$,以及结束方向与目标结束方向的夹角是否不超过 $10^{-6}$。对于每个圆弧段,评测程序将检查圆心到每个端点的距离之差是否不超过 $10^{-6}$,且这些距离不小于 $r_0 - 10^{-6}$。

注意,输出非常短的线段是危险的,因为舍入误差可能会对确定其方向产生很大影响,从而导致无法通过上述测试。特别是,零长度的线段总是会导致错误答案。

样例

样例输入 1

1 2 3
0 1 0
3 7 3
1 0 0
2

样例输出 1

2
1 1.0 5.0 3.0
2 3.0 7.0 3.0 3.0 5.0 3.0

样例输入 2

1 2 3
4 5 6
1 2 3
4 5 6
1

样例输出 2

0

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.