기출 문제 / 삼성 2022 First Half Morning Problem 1

Tag Game

We are going to play a tag game. The tag game is conducted on an n×n grid, and the tagger initially stands at the center.

In the tag game, there are m runners. The runners start at designated positions. The runners do not start from the center. There are two types of runners: those who move only horizontally and those who move only vertically.