CF489E.Hiking
提高+/省选-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
A traveler is planning a water hike along the river. He noted the suitable rest points for the night and wrote out their distances from the starting point. Each of these locations is further characterized by its picturesqueness, so for the i-th rest point the distance from the start equals x__i, and its picturesqueness equals b__i. The traveler will move down the river in one direction, we can assume that he will start from point 0 on the coordinate axis and rest points are points with coordinates x__i.
Every day the traveler wants to cover the distance l. In practice, it turns out that this is not always possible, because he needs to end each day at one of the resting points. In addition, the traveler is choosing between two desires: cover distance l every day and visit the most picturesque places.
Let's assume that if the traveler covers distance r__j in a day, then he feels frustration
, and his total frustration over the hike is calculated as the total frustration on all days.
Help him plan the route so as to minimize the relative total frustration: the total frustration divided by the total picturesqueness of all the rest points he used.
The traveler's path must end in the farthest rest point.
一名旅行者计划沿河进行一次水上徒步旅行。他标记出了适合夜间休息的地点,并记录下这些地点距起点的距离。每个地点还具有各自的风景优美程度(即“画面感”),因此对于第 i 个休息点,其距起点的距离为 xi,风景优美程度为 bi。旅行者将沿河流单向行进;我们可以假设他从坐标轴上的点 0 出发,而各休息点则位于坐标 xi 处。
旅行者希望每天行走的距离恰好为 l。但在实际中,这并不总能实现,因为他每天必须在某个休息点结束当日行程。此外,旅行者需在两个目标之间做出权衡:每日行走距离尽可能接近 l,以及尽可能多地造访风景优美的地点。
我们假定:若旅行者某天行走的距离为 rj,则他当天产生的挫败感为
,
而整段旅程的总挫败感等于所有天数挫败感之和。
请帮助他规划路线,使得相对总挫败感(即:总挫败感 ÷ 所选用休息点的风景优美程度之和)最小化。
旅行者的路径必须以最远的休息点作为终点。
输入格式
The first line of the input contains integers n, l (1 ≤ n ≤ 1000, 1 ≤ l ≤ 105) — the number of rest points and the optimal length of one day path.
Then n lines follow, each line describes one rest point as a pair of integers x__i, b__i (1 ≤ x__i, b__i ≤ 106). No two rest points have the same x__i, the lines are given in the order of strictly increasing x__i.
输入的第一行包含两个整数 n 和 l(1≤n≤1000,1≤l≤105)——分别表示休息点的数量和每日行程的理想长度。
接下来有 n 行,每行用一对整数 xi,bi(1≤xi,bi≤106)描述一个休息点。任意两个休息点的 xi 值互不相同,且各行按 xi 严格递增的顺序给出。
输出格式
Print the traveler's path as a sequence of the numbers of the resting points he used in the order he used them. Number the points from 1 to n in the order of increasing x__i. The last printed number must be equal to n.
按旅行者使用休息点的顺序,输出其路径,即一串休息点编号。将各点按 xi 升序编号为 1 至 n。最后输出的数字必须等于 n。
输入输出样例
输入#1
5 9 10 10 20 10 30 1 31 5 40 10
输出#1
1 2 4 5
说明/提示
In the sample test the minimum value of relative total frustration approximately equals 0.097549. This value can be calculated as
.
在样例测试中,相对总挫败感的最小值约为 0.097549。该值可计算为
。
输入解题思路,AI测评打分。不知道怎么写?