CF958A3.Death Stars (hard)
NOI/NOI+/CTSC
通过率:0%
时间限制:7.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The stardate is 2015, and Death Stars are bigger than ever! This time, two rebel spies have yet again given Heidi two maps with the possible locations of the Death Stars.
Heidi has now received two maps with possible locations of N Death Stars. She knows that each of the maps is possibly corrupted, and may contain some stars that are not Death Stars. Furthermore, each of the maps was created from a different point of view. Hence, stars that are shown in one of the maps are rotated and translated with respect to the other map. Now Heidi wants to find out which of the stars shown in both maps are actually Death Stars, and the correspondence between the Death Stars on the two maps.
星际日期为2015年,死星比以往任何时候都更加庞大!这一次,两名义军间谍再次向海蒂提供了两张标有死星可能位置的地图。
海蒂现已收到两张标有 N 颗死星可能位置的地图。她知道每张地图都可能遭到损坏,其中可能包含一些并非死星的恒星。此外,这两张地图是从不同视角绘制而成的,因此一张地图中显示的恒星相对于另一张地图发生了旋转与平移。现在,海蒂希望确定:两张地图中共同显示的恒星中,哪些确实是死星,并找出两张地图上死星之间的一一对应关系。
输入格式
The first line of the input contains an integer N (1000 ≤ N ≤ 50000) – the number of Death Stars. The second line of the input contains an integer _N_1 (N ≤ _N_1 ≤ 1.5·N) – the number of stars in the first map. The next _N_1 lines specify the coordinates of the stars in the first map. The i-th line contains two space-separated floating-point numbers x__i and y__i with two decimal digits of precision each, representing the coordinates of the i-th star in the first map.
The next line of the input contains an integer _N_2 (N ≤ _N_2 ≤ 1.5·N) – the number of stars in the second map. The next _N_2 lines contain locations of the stars in the second map, given in the same format as for the first map.
输入的第一行包含一个整数 N(1000 ≤ N ≤ 50000)—— 表示死星的数量。
第二行包含一个整数 N1(N ≤ N1 ≤ 1.5⋅N)—— 表示第一张星图中的恒星数量。
接下来的 N1 行描述第一张星图中各恒星的坐标。第 i 行包含两个以空格分隔的浮点数 xi 和 yi,均保留两位小数,表示第一张星图中第 i 颗恒星的坐标。
下一行包含一个整数 N2(N ≤ N2 ≤ 1.5⋅N)—— 表示第二张星图中的恒星数量。
接下来的 N2 行以与第一张星图相同的格式给出第二张星图中各恒星的位置。
输出格式
You should output exactly N lines, each containing a space-separated pair of integers _i_1 and _i_2. Each such line should indicate that the star numbered _i_1 in the first map corresponds to the star numbered _i_2 in the second map. Your answer will be considered correct if over 90% of the distinct pairs listed in your output are indeed correct.
你应该输出恰好 N 行,每行包含一对以空格分隔的整数 _i_1 和 _i_2。每一行应表示:第一张星图中编号为 _i_1 的恒星与第二张星图中编号为 _i_2 的恒星相对应。若你的输出中超过 90% 的不同数对确实正确,则你的答案将被视为正确。
说明/提示
The tests are generated in the following way:
- The number of Death Stars N is pre-selected in some way.
- The numbers of stars on the first and on the second map, _N_1 and _N_2, are selected uniformly at random between 1.0 × N and 1.5 × N.
- N Death Stars are generated at random, with coordinates between - 10000 and 10000.
- Additional _N_1 - N and _N_2 - N stars for the first and for the second map respectively are generated in the same way.
- A translation vector (dx, dy) is generated, with dx and dy selected uniformly at random between - 10000 and 10000. Each point in the first map is translated by (dx, dy).
- A rotation angle θ is generated, with θ selected uniformly at random between 0 and 2π. Each point in the first map is rotated by an angle of θ around the origin.
- Translations and rotations for the second map are generated and applied in the same way.
- The order of points is randomly permuted for both maps.
- The test case is saved, with each point written with two decimal digits of precision.
测试用例按以下方式生成:
- 死星数量 N 以某种方式预先选定。
- 第一张和第二张星图上的恒星数量 N1 和 N2 分别在区间 1.0×N 到 1.5×N 内均匀随机选取。
- 随机生成 N 颗死星,其坐标在 −10000 到 10000 之间。
- 第一张和第二张星图分别额外随机生成 N1−N 颗和 N2−N 颗恒星,生成方式同上。
- 生成一个平移向量 (dx,dy),其中 dx 和 dy 在 −10000 到 10000 之间均匀随机选取;第一张星图中的每个点均按该向量平移。
- 生成一个旋转角度 θ,其中 θ 在 0 到 2π 之间均匀随机选取;第一张星图中的每个点均绕原点旋转角度 θ。
- 第二张星图的平移和旋转也以相同方式生成并应用。
- 两张星图中各点的顺序均被随机打乱。
- 测试用例被保存,每个点的坐标均保留两位小数精度。
输入解题思路,AI测评打分。不知道怎么写?