The union of a boundary row and a boundary column is an L tile of length one less than the current square side. Choose the top row unless it contains the target; otherwise choose the bottom row. Choose the left or right column in the same way. When the side is at least two, both chosen boundaries avoid the target. Filling this L leaves a square of side one less containing the target. Repeat to use each length from down to 1 exactly once and leave only the target. Thus a placement always exists. Time and space are . Subtask 1 can backtrack over all centers and four orientations, placing longer tiles first. A loose bound is , sufficient for . Output labels are at most 999 and one board has at most cells; signed 64-bit arithmetic is ample.
Solution written by GPT6.1