QOJ.ac

QOJ

実行時間制限: 3.0 s メモリ制限: 512 MB 満点: 100 ハック可能 ✓

#10752. 平行线

統計

在二维平面上,曾经有 $k$ 条平行线和 $n$ 个位于这些直线上的点。已知每条直线上至少有两个点。

现在给定这 $n$ 个点,你的任务是找出这 $k$ 条平行线。

输入格式

第一行包含两个整数 $n, k$ ($2 \le n \le 10^4, 1 \le k \le \min(50, \frac{n}{2})$),分别表示点的数量和平行线的数量。

接下来的 $n$ 行中,第 $i$ 行包含两个整数 $x_i, y_i$ ($1 \le x_i, y_i \le 10^9$),表示第 $i$ 个点的坐标。

保证 $n$ 个点两两不同(即对于任意 $1 \le i < j \le n$,满足 $x_i \neq x_j$ 或 $y_i \neq y_j$)。

输出格式

输出包含 $k$ 行。

在第 $i$ 行,首先输出一个整数 $m_i$ ($2 \le m_i \le n$),表示第 $i$ 条平行线上的点数。然后输出 $m_i$ 个整数,表示第 $i$ 条平行线上点的编号(点的编号从 1 开始,按输入顺序排列)。

你的输出应满足每个点恰好出现在一条直线上,且这 $k$ 条直线是平行且不同的。

保证存在将 $n$ 个点分配到 $k$ 条平行线上的合法解。如果存在多种解,输出其中任意一种即可。

样例

输入格式 1

4 2
1 3
2 5
4 7
5 9

输出格式 1

2 3 4
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.