Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
The implementation is long - we want to perfrom the following steps: * Find all viral regions (connected components), additionally for each region keeping track of the frontier (neighboring uncontaminated cells), and the perimeter of the region. * Disinfect the most viral region, adding it's perimeter to the answer. * Spread the virus in the remaining regions outward by 1 square.