QOJ.ac

QOJ

Time Limit: 8 s Memory Limit: 1024 MB Total points: 100

#3947. 安全驾驶

Statistics

从 Askøy 到 Bergen 新建了一条公路。在公路对公众开放之前,需要决定实施哪些限速规定。交通部长希望从 Askøy 到 Bergen 的行驶时间尽可能短,但他同时也施加了一些限制:

  • 出于安全考虑,通过角度为 $\alpha$ 的转弯时,限速最高为 $|180 - \alpha|$ km/h。即使在直路上,限速也不能超过 $180$ km/h。
  • 为了节省标志牌成本,交通部长只允许在沿途设置 $k$ 个限速标志。

CC0 via Pxhere

该公路被设计为一条折线,由 $n$ 个坐标点组成:公路从第一个位置开始,沿直线到达第二个位置,从那里沿直线到达第三个位置,依此类推,直到到达最终位置。注意,公路可能会通过桥梁或隧道与自身交叉,但不会存在汽车可以抄近道的交叉路口。

初始限速为 $180$ km/h。注意,允许将两个限速标志放置在非常靠近的位置,且交通部长允许限速标志保留无限精度的十进制数值。

输入格式

输入的第一行包含两个正整数 $n$ ($2 \le n \le 200$) 和 $k$ ($1 \le k \le 50$)。接下来的 $n$ 行,每行包含描述公路的折线坐标,从 Askøy 的起点开始,到 Bergen 的终点结束。第 $i$ 个位置由两个实数 $x_i$ 和 $y_i$ ($-1\,000\,000 \le x_i, y_i \le 1\,000\,000$) 描述,表示距离任意选定原点的坐标(单位为千米)。所有转弯的角度(顺时针或逆时针)最大为 $179$ 度,坐标给出时小数点后最多有 $6$ 位。

输出格式

一个实数,表示从 Askøy 到 Bergen 的最短行驶时间(单位为小时)。任何与标准答案的绝对误差或相对误差在 $10^{-6}$ 以内的答案都将被接受。

样例

输入 1

6 2
0.0 0.0
90.0 0.0
90.0 30.0
120.0 30.0
120.0 0.0
210.0 0.0

输出 1

2.0

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.