Problem #63 MEDIUM
The Trapped Miners
Scenario Game Theory Optimization Logic
Problem Statement
Six miners with climbing times 1, 3, 5, 8, 9, and 12 minutes must escape a shaft one or two at a time, with one shared head torch that must be returned after each trip. What is the minimum total time to evacuate all six miners, and what is the optimal sequence?
Answer & Quick Explanation
Think you've got it? Click below to check your answer.
All six miners escape in 37 minutes. Optimal sequence: A+B up (3), A down (1), E+F up (12), B down (3), A+B up (3), A down (1), C+D up (8), B down (3), A+B up (3). Total: 37 minutes — 8 minutes before the tunnel becomes dangerous.
Detailed Editorial Solution
Want to see the step-by-step breakdown? Click below to reveal the editorial.
With 6 miners, the torch must make 5 upward trips and 4 return trips (11 trips total). The naive approach has the fastest miner (A=1min) escort each person individually, costing 1+3+1+5+1+8+1+9+1+12 = 41 minutes. The optimal approach batches slow pairs.
Step 1: Trip 1 up: A+B (3 min). Trip 2 down: A returns (1 min). Elapsed: 4 min.
Step 2: Trip 3 up: E+F together (12 min — the two slowest). Trip 4 down: B returns (3 min). Elapsed: 19 min.
Step 3: Trip 5 up: A+B (3 min). Trip 6 down: A returns (1 min). Elapsed: 23 min.
Step 4: Trip 7 up: C+D together (8 min — next slowest pair). Trip 8 down: B returns (3 min). Elapsed: 34 min.
Step 5: Trip 9 up: A+B (3 min). All 6 miners are up. Total elapsed: 37 minutes. Under 45 minutes ✓.
Key Insight:
The saving over naive (41 min vs 37 min) comes from batching the two slowest pairs (E+F=12, C+D=8) so their slow trips are paid only once each. The cost of extra return trips by fast miners is less than the savings from avoiding individual escort of slow miners.