QOJ.ac

QOJ

时间限制: 1.5 s 内存限制: 1024 MB 总分: 100

#10531. 极点转弯

统计

欢迎参加机器人竞赛。在比赛中,你将获得一个放置在平坦场地上的圆盘状机器人。地面上竖立着一组杆子。机器人可以在所有方向上移动,但必须避开这些杆子。不过,机器人可以绕着杆子转弯,并与它们接触。

你的任务是找到机器人到达给定目标位置的最短路径。路径长度定义为机器人中心移动的距离。图 H.1 展示了一个样例布局的最短路径。在该图中,连接一对杆子的红线表示这两根杆子之间的距离小于机器人的直径,因此机器人无法从它们之间穿过。

图 H.1. 样例布局的最短路径

输入格式

输入包含单个测试用例。

第一行包含三个整数。$N$ 表示杆子的数量 ($1 \le N \le 8$)。$(G_x, G_y)$ 表示目标位置。机器人从中心位于 $(0, 0)$ 的位置开始,当机器人中心到达位置 $(G_x, G_y)$ 时,任务完成。你可以假设起始位置和目标位置不相同。

接下来的 $N$ 行,每行包含两个整数。$(x_i, y_i)$ 表示第 $i$ 根杆子的位置。$(G_x, G_y)$ 和 $(x_i, y_i)$ 的每个输入坐标都在 $-1000$ 到 $1000$ 之间(含边界)。机器人的半径为 $100$,你可以忽略杆子的粗细。没有杆子位于距离起始位置或目标位置 $100.01$ 半径的范围内。对于第 $i$ 根和第 $j$ 根杆子之间的距离 $d_{i,j}$ ($i \neq j$),你可以假设 $1 \le d_{i,j} < 199.99$ 或 $200.01 < d_{i,j}$。

图 H.1 展示了下方样例 1 的最短路径,图 H.2 展示了其余样例的最短路径。

图 H.2. 样例布局的最短路径

输出格式

输出机器人到达目标的最短路径长度。如果机器人无法到达目标,则输出 $0.0$。输出的误差不应超过 $0.0001$。

样例

样例输入 1

8 900 0
40 100
70 -80
350 30
680 -20
230 230
300 400
530 130
75 -275

样例输出 1

1210.99416

样例输入 2

1 0 200
120 0

样例输出 2

200.0

样例输入 3

3 110 110
0 110
110 0
200 10

样例输出 3

476.95048

样例输入 4

4 0 200
90 90
-90 90
-90 -90
90 -90

样例输出 4

0.0

样例输入 5

2 0 -210
20 -105
-5 -105

样例输出 5

325.81116

样例输入 6

8 680 -50
80 80
80 -100
480 -120
-80 -110
240 -90
-80 100
-270 100
-420 -20

样例输出 6

1223.53071

样例输入 7

2 -1 600
-99 300
-100 540

样例输出 7

600.01216

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.