No.3232 Not Tic Tac Toe
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Show the original
Problem Statement
You are given positive integers $H,W$.
Output one board with $H$ rows and $W$ columns that satisfies the following conditions.
It can be proved that, under the constraints above, a board satisfying the following conditions always exists.
- Every cell is either
OorX(both are uppercase English letters). -
Neither
OnorXappears $3$ or more times consecutively in a vertical, horizontal, or diagonal line.
More precisely, let $c_{x,y}(1\leq x\leq W,1\leq y\leq H)$ be the character in the cell that is $x$-th from the left and $y$-th from the top.
Then, there exists no pair $(x,y)$ satisfying any of the following.- $x\leq W-2$ and $c_{x,y}=c_{x+1,y}=c_{x+2,y}$
- $y\leq H-2$ and $c_{x,y}=c_{x,y+1}=c_{x,y+2}$
- $x\leq W-2,y\leq H-2$ and $c_{x,y}=c_{x+1,y+1}=c_{x+2,y+2}$
- $x\leq W-2,y\leq H-2$ and $c_{x,y+2}=c_{x+1,y+1}=c_{x+2,y}$
Input
$H\ W$
- $1\leq H,W\leq 3000$
- All inputs are integers.
Output
Output a board satisfying the conditions as $H$ lines, each with $W$ characters (see the sample outputs for details).
Print a newline at the end.
Sample
Sample 1
Input
3 3
Sample Output
XOO OXX OXO
This sample output represents the board shown in the image below.
In this board, every cell is either O or X, and neither O nor X appears $3$ or more times consecutively, so the conditions are satisfied.
Other boards satisfying the conditions also exist, but you should output any one of them.
Sample 2
Input
3 4
Sample Output
XOXO XOOX OXOX
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。