기출 문제 / 삼성 2019 First Half Afternoon Problem 2

Virus Vaccine

In a city of size N×N, a virus has appeared in all areas except for hospitals and walls. Due to cost issues, it is not possible to supply vaccines from all hospitals, so you need to select M hospitals appropriately to eliminate the virus as quickly as possible.