QOJ.ac

QOJ

Límite de tiempo: 1.0 s Límite de memoria: 512 MB Puntuación total: 100

#17629. 距离

Estadísticas

给定整数 $n$ 和 $k$。你的目标是在 $xy$ 平面上选取 $n$ 个不同的整点,使得其中恰好有 $k$ 对点之间的欧几里得距离为整数。回想一下,点 $(x_1, y_1)$ 和 $(x_2, y_2)$ 之间的欧几里得距离为:

$$\sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2}$$

可以证明,在该任务的约束条件下,解总是存在的。

输入格式

仅一行,包含两个整数 $n$ 和 $k$。

输出格式

输出 $n$ 行,第 $i$ 行包含两个整数:第 $i$ 个点的 $x$ 和 $y$ 坐标。每个坐标的绝对值必须不超过 $10^9$。

如果存在多个解,你可以输出其中任意一个。

数据范围

  • $1 \le n \le 100$
  • $0 \le k \le n(n - 1)/2$

样例

输入格式 1

3 2

输出格式 1

1 1
1 2
2 2

说明

$(1, 1)$ 和 $(1, 2)$ 之间的欧几里得距离为 $1$。$(1, 2)$ 和 $(2, 2)$ 之间的距离也为 $1$。然而,$(1, 1)$ 和 $(2, 2)$ 之间的距离为 $\sqrt{2}$,这不是一个整数。

评分

子任务 数据范围 分值
1 $n \le 4$ 11
2 $k = n(n - 1)/2$ 4
3 $k = 0$ 6
4 $k \le n$ 19
5 $k \le n(n - 1)/8$ 22
6 无附加限制 38

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.