QOJ.ac

QOJ

時間限制: 3 s 記憶體限制: 512 MB 總分: 100

#10439. 小行星巡逻队

统计

2112年,人类已经征服了太阳系。太空游骑兵军团在每一块哪怕只有一点点宜居可能性的岩石上都建立了基地。作为小行星通信部的一员,你的工作是确保所有太空游骑兵小行星基地之间能够以尽可能低的成本进行通信。你可以为每个基地之间建立直接通信链路,但这会极其昂贵。相反,你希望建立最少数量的链路,使得每个人都能向其他人发送消息,并可能通过一个或多个基地进行中继。任何链路的成本都与它所连接的两个基地之间的距离成正比,所以这看起来并不是一个难题。

然而,有一个小困难。小行星有移动的趋势,因此目前非常接近的两个基地在未来可能就不再接近了。因此,随着时间的推移,你必须愿意切换你的通信链路,以便始终拥有最便宜的中继系统。切换这些链路需要时间和金钱,所以你想要知道你必须执行多少次这样的切换。

一些假设使你的任务变得简单。每个小行星都被视为一个点。小行星总是以固定的速度线性运动。没有任何小行星会与其他小行星发生碰撞。此外,任何在时间 $t \ge 0$ 变得最优的中继系统,对于满足 $t < s < t + 10^{-6}$ 的任何时间 $s$ 都是唯一最优的。初始的最优中继系统将是唯一的。

输入格式

每个测试用例以一行包含一个整数 $n$ ($2 \le n \le 50$) 开始,表示小行星基地的数量。接下来是 $n$ 行,每行包含六个整数 $x, y, z, v_x, v_y, v_z$。前三个整数指定了小行星的初始位置 ($-150 \le x, y, z \le 150$),后三个整数指定了该小行星在每个时间单位内 $x, y, z$ 方向上的速度分量 ($-100 \le v_x, v_y, v_z \le 100$)。

输出格式

对于每个测试用例,显示一行,包含用例编号以及需要设置或修改中继系统的次数。

样例

输入 1

3
0 0 0 0 0 0
5 0 0 0 0 0
10 1 0 -1 0 0
4
0 0 0 1 0 0
0 1 0 0 -1 0
1 1 1 3 1 1
-1 -1 2 1 -1 -1

输出 1

Case 1: 3
Case 2: 3

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.