Block-Virus Spread Strategy
A virus is spreading rapidly, and your task is to quarantine the infected area by installing walls. The world is modeled as a 2-D array of cells, where 0
represents uninfected cells, and 1
represents virus-infected cells. A wall (and only one wall) can be installed between any two 4-directionally adjacent cells, on the shared boundary. Every night, the virus spreads to all neighboring cells in all four directions unless blocked by a wall. Due to limited resources, each day, you can only install walls around one region—the affected area that poses the greatest threat to uninfected cells for the following night. There will never be a tie in selecting this region.
1.97KB
文件大小:
评论区