ZOJ Problem Set - 1488

Navigation

Time Limit: 2 Seconds      Memory Limit: 65536 KB

There is a computer game which had been quite popular in China about 7 years ago named "Uncharted Waters II". This game has several versions on different platforms and the plot of this game is mainly about a young captain's voyage in the 16th century. There is a useful command in gameplay - devolve. With this command, you can only specify a port and your assistant will automatically guide you there via the shortest path.


(Screenshots for Uncharted Waters on SNES/SFC with emulator ZSNES)

As the topology is quite complicated, finding the shortest path between every two points seemed to be an impossible task at that time with only 486 computers. Actually, the game adopted a special method to get an approximation: There're some pre-set paths between the ports, and whenever you used the devolve command, your assistant first leads your ship to one of the shortest paths as quick as possible and then get to the target port along some preset paths.

One day, your assistant has retired and now you have to write a program to help yourself. Let's first suppose that the surface of the Earth is a plane(It was believed so at that time, wasn't it?), thus all ports can be represented by two coordinates x and y. All the pre-set paths are straight lines connecting two ports.

Now, given the coordinates of all ports and the ports that each pre-set path connects, you are to calculate the shortest paths between given pairs of initial position and a target port. Your result should satisfy:

1. It is (one of) the path(s) that reaches the pre-set paths as early as possible.

2. Under condition 1, it's (one of) the path(s) that reaches the target port as early as possible.


Input

The input contains several test cases. The first line of each case has 3 integers, N (1 <= N <= 50), M and L. N is the number of ports, M is the number of preset paths, L is the number of pairs of initial position and target port.

The following N lines each contains a name consists of no more than 15 letters followed by two real numbers representing the coordinates of that port.

The next M lines each contain the names of the 2 ports that path connects.

The last L lines each contain two real numbers as the coordinates of the initial position and a name as the target port. Input is terminated with a case of N = M = L = 0 which should not be proceeded.

You may assume:

1.Any two ports are connected via several preset paths.

2.No 2 preset paths interact except at ports.

3.All coordinated are between 0 and 1000 inclusively.


Output

For every pair of initial positon and a target port, output the length of the shortest path between them on a line of it's own. Rounded to 2 decimal places. Output a blank line after each case.


Sample Input

2 1 3
Hangzhou 1 1
Shanghai 3 1.5
Hangzhou Shanghai
0 0 Hangzhou
3 1 Hangzhou
0 0 Shanghai
4 4 2
LostTemple 1 1
TheHunters 2 3
NeoJungleStory 4 5
Rivalry 5 1
LostTemple TheHunters
TheHunters NeoJungleStory
NeoJungleStory Rivalry
Rivalry LostTemple
0 0 NeoJungleStory
3 0 NeoJungleStory
0 0 0


Sample Output

1.41
2.43
3.48

6.48
7.12

The two pictures above explain the two samples.


解题报告:

写了好久没写出来,有时间再想想,脑袋要炸了抓狂

weixin073智慧旅游平台开发微信小程序+ssm后端毕业源码案例设计 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。
python017基于Python贫困生资助管理系统带vue前后端分离毕业源码案例设计 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值