기출 문제 / 삼성 2018 Second Half Afternoon Problem 2

Battle Robot

You are given an n×n grid with m monsters and one battle robot. A single cell can contain at most one monster.

Both the battle robot and the monsters have levels, which are natural numbers. The initial level of the battle robot is 2, and it can move one cell up, down, left, or right per second.