Problem context and objectives
Mission briefing
Expedition navigator · Safe camps and hazards form a connected world map
Find a valid route while marking every place already explored: Rotting Frontier.
Without visited state, the party loops forever or revisits expensive terrain.
How you win
- 1Recognize when Multi-source breadth-first search matches the clues
- 2Keep this true after every move: every queued orange has the earliest minute at which any rotten source can reach it
- 3Reach the result within O(rows times columns) time and space
Rules and pressure
- Target cost: O(rows times columns) time and space
- State rule: every queued orange has the earliest minute at which any rotten source can reach it
Lesson 1 of 3
Seed every rotten source at minute zero; each complete frontier creates the next minute together.
Your call · Which minute should a fresh orange between two rotten sources receive?