CF1237C1.Balanced Removals (Easier)
普及+/提高
通过率:0%
时间限制:1.00s
内存限制:512MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
This is an easier version of the problem. In this version, n≤2000.
There are n distinct points in three-dimensional space numbered from 1 to n. The i-th point has coordinates (xi,yi,zi). The number of points n is even.
You'd like to remove all n points using a sequence of 2n snaps. In one snap, you can remove any two points a and b that have not been removed yet and form a perfectly balanced pair. A pair of points a and b is perfectly balanced if no other point c (that has not been removed yet) lies within the axis-aligned minimum bounding box of points a and b.
Formally, point c lies within the axis-aligned minimum bounding box of points a and b if and only if min(xa,xb)≤xc≤max(xa,xb), min(ya,yb)≤yc≤max(ya,yb), and min(za,zb)≤zc≤max(za,zb). Note that the bounding box might be degenerate.
Find a way to remove all points in 2n snaps.
这是一个简化版本的问题。在此版本中,n≤2000。
在三维空间中有 n 个互不相同的点,编号从 1 到 n。第 i 个点的坐标为 (xi,yi,zi)。点的数量 n 是偶数。
你希望用 2n 次“点击”(snap)操作移除全部 n 个点。每次点击操作中,你可以任选两个尚未被移除的点 a 和 b 并将其同时移除,前提是它们构成一个“完美平衡对”。点对 a 和 b 被称为完美平衡的,当且仅当不存在其他尚未被移除的点 c 位于点 a 和 b 的轴对齐最小包围盒(axis-aligned minimum bounding box)内部。
形式化地,点 c 位于点 a 和 b 的轴对齐最小包围盒内,当且仅当
min(xa,xb)≤xc≤max(xa,xb),min(ya,yb)≤yc≤max(ya,yb),min(za,zb)≤zc≤max(za,zb).
注意:该包围盒可能退化(即某维长度为零)。
请找出一种方案,在 2n 次点击操作中移除所有点。
输入格式
The first line contains a single integer n (2≤n≤2000; n is even), denoting the number of points.
Each of the next n lines contains three integers xi, yi, zi (−108≤xi,yi,zi≤108), denoting the coordinates of the i-th point.
No two points coincide.
第一行包含一个整数 n(2≤n≤2000;n 为偶数),表示点的数量。
接下来的 n 行每行包含三个整数 xi、yi、zi(−108≤xi,yi,zi≤108),表示第 i 个点的坐标。
任意两个点均不重合。
输出格式
Output 2n pairs of integers ai,bi (1≤ai,bi≤n), denoting the indices of points removed on snap i. Every integer between 1 and n, inclusive, must appear in your output exactly once.
We can show that it is always possible to remove all points. If there are many solutions, output any of them.
输出 2n 对整数 ai,bi(1≤ai,bi≤n),表示第 i 次“快照”中被移除的点的索引。1 到 n(含)之间的每个整数在你的输出中必须恰好出现一次。
我们可以证明:总是存在一种方式将所有点全部移除。若存在多种解,输出任意一种即可。
输入输出样例
输入#1
6 3 1 0 0 3 0 2 2 0 1 0 0 1 3 0 0 1 0
输出#1
3 6 5 1 2 4
输入#2
8 0 1 1 1 0 1 1 1 0 1 1 1 2 2 2 3 2 2 2 3 2 2 2 3
输出#2
4 5 1 6 2 7 3 8
说明/提示
In the first example, here is what points and their corresponding bounding boxes look like (drawn in two dimensions for simplicity, as all points lie on z=0 plane). Note that order of removing matters: for example, points 5 and 1 don't form a perfectly balanced pair initially, but they do after point 3 is removed.

在第一个示例中,下图展示了各点及其对应的边界框(为简化起见,在二维平面上绘制,因为所有点均位于 z=0 平面上)。注意:移除点的顺序至关重要。例如,点 5 和点 1 最初并不构成一个完全平衡的点对,但在点 3 被移除后,它们便构成了一个完全平衡的点对。

输入解题思路,AI测评打分。不知道怎么写?