QOJ.ac

QOJ

时间限制: 2 s 内存限制: 1024 MB 总分: 100

#11328. 等距

统计

给定 $N$ 维欧几里得空间中的 $M$ 个点,其中任意两点之间的距离均为 $1.0$。问最多还能添加多少个点,使得该等距限制仍然成立?

输出最多可以添加的点的数量,以及这些点的坐标。回想一下,$N$ 维欧几里得空间中两点 $(a_1, a_2, \dots, a_N)$ 和 $(b_1, b_2, \dots, b_N)$ 之间的距离定义为:

$$\sqrt{(a_1 - b_1)^2 + (a_2 - b_2)^2 + \dots + (a_N - b_N)^2}$$

输入格式

输入的第一行包含测试用例的数量 $T$。接下来是 $T$ 个测试用例。

每个测试用例的第一行包含两个整数 $N$ 和 $M$,分别表示欧几里得空间的维数和给定点的数量。接下来有 $M$ 行,每行包含 $N$ 个实数,表示给定点的坐标。保证任意两个给定点之间的距离均为 $1.0$。

输出格式

对于每个测试用例,输出一行 “Case #x: y”,其中 $x$ 是测试用例编号(从 1 开始),$y$ 是在保持等距限制的前提下可以添加的点的最大数量。

接下来 $y$ 行,每行包含 $N$ 个实数,指定所添加点的坐标。对于给定的输入,可能存在多种答案。只要对于每一对点,其距离与 $1.0$ 的绝对差值小于 $10^{-8}$,答案即被接受。

数据范围

  • $1 \le T \le 100$。
  • $1 \le N \le 100$。
  • $1 \le M$。
  • 给定点坐标的绝对值严格小于 $100$。

样例

输入 1

2
1 1
0.0000000000
2 2
1.0000000000 0.0000000000
2.0000000000 0.0000000000

输出 1

Case #1: 1
1.0000000000
Case #2: 1
1.5000000000 0.8660254038

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.