QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22686. 奶牛马拉松

Statistics

听说美国肥胖症盛行后,Farmer John 想让牛多运动,决定为她们举办奶牛马拉松。路线包括两座农场及连接它们的一系列道路组成的路径。为了尽可能多运动,他想找地图上距离最远的两座农场,距离以两者之间路径的道路总长度衡量。请帮他求出这对最远农场的距离。

输入格式

  • 第 1 行及以后:输入格式与“Navigation Nightmare”相同。

输出格式

  • 第 1 行:一个整数,最远两座农场之间的距离。

样例

输入格式 1

7 6
1 6 13 E
6 3 9 E
3 5 7 S
4 1 3 N
2 4 20 W
4 7 2 S

输出格式 1

52

说明

输入格式

农场布局与第 1 题相同。

说明 — 输出格式

最长马拉松从农场 2 经过道路 4、1、6、3 到农场 5,长度为 $20+3+13+9+7=52$。

题目作者:Brian Dean,2004

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.