1015: 湖南省第十八届大学生计算机程序设计竞赛(HNCPC2022) - Semilive

开始 Start
0000-00-0000:00:00UTC+0
结束 End
0000-00-0000:00:00UTC+0
当前 Now
0000-00-0000:00:00UTC+0
状态 Status
加载中Loading
类型 Type
开放Public
榜单 Rank
加载中Loading
公告 Announcement
暂无公告No announcement

B : Complex Maze

时间限制Time Limit
1 秒Sec
内存限制Memory Limit
128 兆MB
提交次数Submitted
175 次Times
通过次数Solved
6 次Times

题目描述Description

The obstacles of a maze consists of 1 simple polygon.

Given a starting point and an ending point, calculate the length of the shortest path between the two points.

Both the start and end points are outside the simple polygon (and not on vertices or edges). The path cannot pass through the obstacle area.

In geometry, a simple polygon is a polygon that does not intersect itself and has no holes. That is, it is a flat shape consisting of straight, non-intersecting line segments or “sides” that are joined pairwise to form a single closed path. If the sides intersect then the polygon is not simple. The qualifier “simple” is frequently omitted, with the above definition then being understood to define a polygon in general.

–Wikipedia

输入格式Input

No more than 20 test cases.

For each test case, the first line is n, meaning the number of vertices in the simple polygon obstacle area.

The next n lines contain each vertex coordinate x y in counter-clockwise order.

The last two lines contain the start and end coordinates respectively.

3 ≤ n ≤ 100, all the coordinates 0 ≤ x, y ≤ 104.

输出格式Output

One line for each test case, corresponding to the shortest path length from the start point to the end point.

The error from the correct answer should not exceed 10−5.

样例Sample