기출 문제 / 삼성 2021 First Half Morning Problem 2

Color Bomb

A grid of size ( n \times n ) is given, consisting only of the numbers (-1), (0), and numbers from (1) to (m). (-1) indicates a black stone in that cell, (0) indicates a red bomb, and numbers from (1) to (m) indicate bombs of different colors other than red.