Skip to content

Sunday Times Teaser 3270 – Tunnel Vision

by BRG on May 25, 2025

by Howard Williams

Published Sunday May 25 2025 (link)

Four ramblers came to a tunnel that they all had to travel through. The tunnel was too dangerous to travel through without a torch, and unfortunately they only had one torch. It was also too narrow to walk through more than two at a time. The maximum walking speed of each of the walkers was such that they could walk through the tunnel in an exact number of minutes, less than ten, which was different for each walker. When two walkers walked together, they would walk at the speed of the slower one.

They all managed to get through the tunnel and in the quickest possible time, this time being five sixths of the total of their individual crossing times.

In ascending order, what are their four individual crossing times?

From → Uncategorized

6 Comments Leave one →
  1. Brian Gladman permalink

  2. John Z. permalink

    • Frits permalink

      @ John, the code apprarently also works with varable name “exit” (lowercase).

      The meaning of your print statement is not clear to me.
      You print (with “s”) only one of the possible strategies to to get through the tunnel in the quickest possible time.

  3. BRG permalink

    Hi John, I like the code in your solution but I am not convinced about the layout as I much prefer the PEP8 approach which suggest that inline comments should be used sparingly. Also your code has far too much vertical space for my liking. I hope you don’t mind but I have taken the liberty of recasting your solution in my style (also with a couple of minor code changes)

    Although it is slower than my version, another really big advantage of your solution is that it is not tied to a specific range of tunnel transit times or numbers of walkers which makes it very easy to try other scenarios.

    • John Z permalink

      Thanks, Brian.
      I will try to apply your recommendations in future.

  4. John Z permalink

    Post analysis shows that the phrase “in the quickest possible time” in the teaser statement is not a hard constraint: its non-observance does not prevent finding a unique solution as demonstrated by the slightly modified code below where there is no attempt to find the minimum time.

Leave a Reply

Note: HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS