CF1184C3.Heidi and the Turing Test (Hard)
NOI/NOI+/CTSC
通过率:0%
时间限制:15.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The Cybermen have again outwitted the Daleks! Unfortunately, this time the Daleks decided to abandon these tasks altogether, which means the Doctor has to deal with them.
The Doctor can handle the Daleks on his own, but Heidi now has to make sure that the Cybermen are kept busy with this next task.
There are k rings on a plane. For each ring, n points are uniformly sampled with a small random noise. The task is to recover the rings given only the noisy samples.
The rings and the samples are generated as follows. The center of a ring is uniformly sampled from a disk of radius 1000000 centered at the origin, and the radius of the ring is uniformly sampled from [250000,750000]. Let R be a ring with center (x,y) and radius r. To sample a point from R, an angle θ is uniformly sampled from [0,2π] and a distance d is uniformly sampled from [0.9r,1.1r]. The coordinates of the sampled point are then (x+dcos(θ),y+dsin(θ)) rounded to the closest integers.
The distance between rings is measured by their Hausdorff distance. In our case, the distance between two rings R1,R2 can be written as follow. Let d be the distance between the two centers and r1,r2 be the radii. Then the distance is $$dist(R_1, R_2)=\max(\min(d_{--}, d_{-+}),\min(d_{+-}, d_{}), \min(d_{--}, d_{+-}), \min(d_{-+}, d_{}))$$, where d++=∣d+r1+r2∣, d+−=∣d+r1−r2∣, d−+=∣d−r1+r2∣, d−−=∣d−r1−r2∣.
We say that a ring R0 is recovered if one of the rings R in the output has Hausdorff distance less than 100000 from R0.
An output is accepted if all the rings are recovered. It is guaranteed that the distances between any two rings is greater than 600000.
Remember that a human can very easily solve this task, so make sure that no human traitors are helping the Cybermen complete this task.
赛博人再次智胜了戴立克!不幸的是,这一次戴立克决定彻底放弃这些任务,这意味着博士必须独自应对他们。
博士可以独自应付戴立克,但海蒂现在必须确保赛博人被接下来的这项任务牢牢牵制住。
平面上有 k 个圆环。对每个圆环,均匀采样 n 个点,并加入微小的随机噪声。任务是仅根据这些带噪声的采样点,恢复出原始的圆环。
圆环及其采样点按如下方式生成:圆环中心在以原点为中心、半径为 1000000 的圆盘内均匀随机采样;圆环半径则在区间 [250000,750000] 内均匀随机采样。设圆环 R 的中心为 (x,y)、半径为 r。为从 R 上采样一个点,首先在 [0,2π] 内均匀随机采样一个角度 θ,再在 [0.9r,1.1r] 内均匀随机采样一个距离 d;然后该采样点的坐标为 (x+dcos(θ),y+dsin(θ)),并四舍五入至最接近的整数。
圆环之间的距离采用豪斯多夫距离(Hausdorff distance)度量。在本题中,两个圆环 R1,R2 之间的距离可表示为:设两中心间距离为 d,半径分别为 r1,r2,则距离为
dist(R_1,R_2)=max(min(d_−−,d_−+),min(d_+−,d_++),min(d_−−,d_+−),min(d_−+,d_++))
其中 d++=∣d+r1+r2∣,d+−=∣d+r1−r2∣,d−+=∣d−r1+r2∣,d−−=∣d−r1−r2∣。
若输出中存在某个圆环 R,其与真实圆环 R0 的豪斯多夫距离小于 100000,则称 R0 被成功恢复。
当所有圆环均被成功恢复时,该输出即被接受。题目保证任意两个真实圆环之间的距离均大于 600000。
请牢记:人类能非常轻松地完成此任务,因此务必确保没有任何人类叛徒协助赛博人完成此项任务。
输入格式
The first line contains an integer k (1≤k≤4), the number of rings.
The second line contains an integer n (100≤n≤1000), the number of samples per ring.
The following n×k lines contain the samples, one sample per line.
Each line contains a pair of integers xi,yi, where (xi,yi) are the coordinates of the i-th sample.
第一行包含一个整数 k(1≤k≤4),表示圆环的数量。
第二行包含一个整数 n(100≤n≤1000),表示每个圆环的采样点数量。
接下来的 n×k 行包含所有采样点,每行一个采样点。
每行包含一对整数 xi,yi,其中 (xi,yi) 是第 i 个采样点的坐标。
输出格式
Print k lines, each describing a single ring.
For each line, print three real numbers xi,yi,ri, where (xi,yi) and ri are the coordinates and the radius of the i-th ring.
The order of the rings does not matter.
输出 k 行,每行描述一个环。
对于每一行,输出三个实数 xi,yi,ri,其中 (xi,yi) 和 ri 分别为第 i 个环的圆心坐标和半径。
环的输出顺序无关紧要。
输入解题思路,AI测评打分。不知道怎么写?
