CF39C.Moon Craters

提高+/省选-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

There are lots of theories concerning the origin of moon craters. Most scientists stick to the meteorite theory, which says that the craters were formed as a result of celestial bodies colliding with the Moon. The other version is that the craters were parts of volcanoes.

An extraterrestrial intelligence research specialist professor Okulov (the namesake of the Okulov, the author of famous textbooks on programming) put forward an alternate hypothesis. Guess what kind of a hypothesis it was –– sure, the one including extraterrestrial mind involvement. Now the professor is looking for proofs of his hypothesis.

Professor has data from the moon robot that moves linearly in one direction along the Moon surface. The moon craters are circular in form with integer-valued radii. The moon robot records only the craters whose centers lay on his path and sends to the Earth the information on the distance from the centers of the craters to the initial point of its path and on the radii of the craters.

According to the theory of professor Okulov two craters made by an extraterrestrial intelligence for the aims yet unknown either are fully enclosed one in the other or do not intersect at all. Internal or external tangency is acceptable. However the experimental data from the moon robot do not confirm this theory! Nevertheless, professor Okulov is hopeful. He perfectly understands that to create any logical theory one has to ignore some data that are wrong due to faulty measuring (or skillful disguise by the extraterrestrial intelligence that will be sooner or later found by professor Okulov!) That’s why Okulov wants to choose among the available crater descriptions the largest set that would satisfy his theory.

关于月球环形山的起源,存在大量理论。大多数科学家支持陨石撞击理论,该理论认为环形山是由天体撞击月球表面所形成的。另一种观点则认为,这些环形山是火山的一部分。

一位外星智能研究专家——奥库洛夫教授(即著名编程教材作者奥库洛夫的同名人物)提出了一个替代性假说。猜猜这是一种什么样的假说?没错,正是涉及外星智慧干预的假说。目前,这位教授正在为其假说寻找证据。

教授拥有一台在月球表面沿单一方向作直线运动的月球机器人所采集的数据。月球环形山呈圆形,其半径为整数值。该月球机器人仅记录其中心恰好位于其行进路径上的环形山,并向地球发送这些环形山中心到其路径起点的距离以及环形山半径的信息。

根据奥库洛夫教授的理论,由外星智能出于某种尚不为人知的目的所制造的两个环形山,二者之间要么完全相互嵌套(即一个完全包含于另一个内部),要么完全不相交。允许内切或外切情形。然而,月球机器人所获得的实验数据却未能证实这一理论!尽管如此,奥库洛夫教授仍充满希望。他非常清楚:构建任何逻辑理论时,都必须忽略一些因测量误差(或外星智能刻意伪装——而这种伪装迟早会被奥库洛夫教授识破!)而导致的错误数据。因此,奥库洛夫希望从当前所有可用的环形山描述中,选出一个满足其理论的最大子集。

输入格式

The first line has an integer n (1 ≤ n ≤ 2000) — the number of discovered craters. The next n lines contain crater descriptions in the "c__i r__i" format, where c__i is the coordinate of the center of the crater on the moon robot’s path, r__i is the radius of the crater. All the numbers c__i and r__i are positive integers not exceeding 109. No two craters coincide.

第一行包含一个整数 nn(1≤n≤20001 \leq n \leq 2000)——表示已发现的陨石坑数量。接下来的 nn 行每行描述一个陨石坑,格式为“ci ric_i\ r_i”,其中 cic_i 是该陨石坑中心在月球机器人行进路径上的坐标,rir_i 是该陨石坑的半径。所有数字 cic_i 和 rir_i 均为不超过 10910^9 的正整数。任意两个陨石坑均不重合。

输出格式

In the first line output the number of craters in the required largest set. In the next line output space-separated numbers of craters that this set consists of. The craters are numbered from 1 to n in the order in which they were given in the input data. The numbers may be output in any order. If the result is not unique, output any.

第一行输出所要求的最大集合中陨石坑的数量。
第二行输出该集合所包含的陨石坑编号,编号之间用空格分隔。陨石坑按输入数据中的顺序从 1 到 nn 编号。编号的输出顺序可以任意。若结果不唯一,输出任意一个即可。

输入输出样例

  • 输入#1

    4
    1 1
    2 2
    4 1
    5 1

    输出#1

    3
    1 2 4

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

首页