#P7754. Chessboard Painting

    ID: 20941 Type: Default 1000ms 256MiB

Chessboard Painting

Chessboard Painting

The chessboard is composed of red and white cells arranged in an alternating pattern. The top-left cell is red. In this problem, we use X to represent a red cell and . to represent a white cell. The chessboard consists of r×c cells, and each cell is drawn as a matrix of characters with dimensions a×b.

The red and white pattern follows the rule: a cell at board position \( (i,j) \) (0-indexed) is red if \( i+j \) is even, and white if it is odd. Each cell is printed as a block of size \( a \) rows and \( b \) columns.

Your task is to help Mirko draw this chessboard.

inputFormat

The input consists of four positive integers: r c a b.

  • r: the number of rows of cells in the chessboard.
  • c: the number of columns of cells in the chessboard.
  • a: the number of character rows for each cell.
  • b: the number of character columns for each cell.

Values are separated by spaces.

outputFormat

Output the chessboard drawn as a character matrix. The final matrix will have r * a rows and c * b columns. There should be no extra spaces in the output.

sample

1 1 1 1
X