编程介的小学生 2016-11-12 12:29 采纳率: 20.5%
浏览 1041
已采纳

Bus Schedules

问题描述 :

The Association of Commuters in Montreal (ACM) wishes to create a website for the city’s publictransit commuters, in order to promote public transit. A prominent reason for people to drive to work instead of commuting is the time wasted on the subway and buses. For this reason, the ACM wishes to add a form on their website so that visitors will be able to specify two points on the island, and the website will find the quickest route between those two points using its database of subway and bus schedules.

Seeing how this may help improve the environment and the greenhouse effect, you offer your help.
输入:

The first line of each test case will contain a positive integer n, the number of bus and subway schedules which will follow. Each schedule will begin with a line containing a positive integer m, the number of stops along the path. m lines will follow, describing the stops of the day in chronological order. Each stop will begin by a time in the format hh : mm, between 00 : 00 and 23 : 59 inclusively. There will be at least one minute between each stop ― in other words, all the stop times for a particular bus will be different. A single space will follow, and the rest of the line will contain a name describing the stop.
The name will not contain spaces nor capital letters, and will be at most 20 characters long. Stops with the same name obviously denote the same physical location, where passengers can wait for other buses or subways to stop. After the day completes, the buses and subways mysteriously disappear and reappear at some point before their first stop. They cannot carry any passengers at that time, so the passengers must spend the night waiting at some stop.Each schedule repeats itself every day.

After the schedules, a line will contain a time and two locations of at most 20 characters, the start and the goal. Output the minimum number of minutes needed for a passenger at the start location at the given time to reach the goal location. He is able to enter any bus which stops at his start location at the given starting time or later, and he can also switch from a bus to another instantaneously if they happen to stop at the same place at the same time. He can also wait at a stop for an arbitrary amount of time.

输出:

The first line of each test case will contain a positive integer n, the number of bus and subway schedules which will follow. Each schedule will begin with a line containing a positive integer m, the number of stops along the path. m lines will follow, describing the stops of the day in chronological order. Each stop will begin by a time in the format hh : mm, between 00 : 00 and 23 : 59 inclusively. There will be at least one minute between each stop ― in other words, all the stop times for a particular bus will be different. A single space will follow, and the rest of the line will contain a name describing the stop.
The name will not contain spaces nor capital letters, and will be at most 20 characters long. Stops with the same name obviously denote the same physical location, where passengers can wait for other buses or subways to stop. After the day completes, the buses and subways mysteriously disappear and reappear at some point before their first stop. They cannot carry any passengers at that time, so the passengers must spend the night waiting at some stop.Each schedule repeats itself every day.

After the schedules, a line will contain a time and two locations of at most 20 characters, the start and the goal. Output the minimum number of minutes needed for a passenger at the start location at the given time to reach the goal location. He is able to enter any bus which stops at his start location at the given starting time or later, and he can also switch from a bus to another instantaneously if they happen to stop at the same place at the same time. He can also wait at a stop for an arbitrary amount of time.

  • 写回答

1条回答 默认 最新

  • threenewbee 2016-11-12 13:02
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作