CF489E.Hiking

普及/提高-

通过率:0%

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 ii -th rest point the distance from the start equals xix_{i} , and its picturesqueness equals bib_{i} . The traveler will move down the river in one direction, we can assume that he will start from point 00 on the coordinate axis and rest points are points with coordinates xix_{i} .

Every day the traveler wants to cover the distance ll . 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 ll every day and visit the most picturesque places.

Let's assume that if the traveler covers distance rjr_{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.

输入格式

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 ii -th rest point the distance from the start equals xix_{i} , and its picturesqueness equals bib_{i} . The traveler will move down the river in one direction, we can assume that he will start from point 00 on the coordinate axis and rest points are points with coordinates xix_{i} .

Every day the traveler wants to cover the distance ll . 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 ll every day and visit the most picturesque places.

Let's assume that if the traveler covers distance rjr_{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.

输出格式

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 ii -th rest point the distance from the start equals xix_{i} , and its picturesqueness equals bib_{i} . The traveler will move down the river in one direction, we can assume that he will start from point 00 on the coordinate axis and rest points are points with coordinates xix_{i} .

Every day the traveler wants to cover the distance ll . 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 ll every day and visit the most picturesque places.

Let's assume that if the traveler covers distance rjr_{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.

输入输出样例

  • 输入#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 .

首页