过桥问题
Bridge Crossing
题目详情
David、Emma、Frank、Grace 需要在夜里过桥。桥上一次最多容纳 2 人,且必须携带唯一的一盏灯才能过桥。两人同行的用时等于其中较慢者。
他们过桥时间分别为:David 10 分钟,Emma 5 分钟,Frank 2 分钟,Grace 1 分钟。
问:全员到达对岸所需的最短时间是多少?
David, Emma, Frank, and Grace need to cross a river. The only possible way to cross the river is a bridge that can only hold at maximum people at once. It's night time, so they can only cross the bridge using a lantern and they only have lantern. Each pair of people can only cross at the pace of the slowest person. All people need to get across as fast as possible. Their crossing times are as follows: David takes minutes, Emma takes minutes, Frank takes minutes, and Grace takes minute. What is the minimum time required for all of them to get across to the other side?
解析
最优思路是让最快的人负责多次带灯返回,同时让最慢的两人同去但不在第一趟。
一种最优方案:
- Frank + Grace 过桥:2 分钟。
- Grace 带灯返回:1 分钟。
- David + Emma 过桥:10 分钟。
- Frank 带灯返回:2 分钟。
- Frank + Grace 再次过桥:2 分钟。
总时间: 分钟。
Original Explanation
The key point is to realize that the person returning with the lantern does not have to be from the most recent pairing. Another point to realize is that David and Emma should go together, since they're the slowest, but not in the first crossing; otherwise, one of them has to go back, which will take too long. Hence, Frank and Grace should go across first, which takes minutes. Grace is then sent back with the lantern, which takes minute. David and Emma go across, which takes minutes. Frank returns with the lantern, which takes minutes. Finally, Frank and Grace cross again, which takes minutes, for a total of minutes.