Simulate minute by minute: scan entire grid, mark oranges that should rot, update grid, repeat.
Each minute, you scan cells. With up to oranges, worst case .
Can you avoid rescanning the entire grid each minute?
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
The trap
Simulate minute by minute: scan entire grid, mark oranges that should rot, update grid, repeat.
Each minute, you scan cells. With up to oranges, worst case .
Can you avoid rescanning the entire grid each minute?