A9735 | Hiking
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
输入格式
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.
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.
输出格式
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.
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.
输入输出样例
输入 #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 .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted