기출 문제 / 삼성 2021 Second Half Afternoon Problem 1

Pac-Man

In a 4×4 grid, there are m monsters and 1 Pac-Man. Each monster has one of the directions: up, down, left, right, or diagonal. The Pac-Man game proceeds in turns, and each turn is conducted as follows: