No.2728 Grid Expansion
タグ : / 解いたユーザー数 224
作問者 :
kusirakusira
/ テスター :
👑
FplusFplusF
みどりむし🦠
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
There is a grid with $N$ rows and $N$ columns. The cell in the $i$-th row from the top $(0 \leqq i < N)$ and the $(0 \leqq j < N)$-th column from the left is denoted by $(i, j)$.
For each $i,j (0 \leqq i < N, 0 \leqq j < N)$, the information of cell $(i, j)$ is given by a character $A_{i,j}$.
If $A_{i,j}$ is ., then cell $(i, j)$ is white, and if $A_{i, j}$ is #, then cell $(i, j)$ is black.
You are given a positive integer $K$. Enlarge the original grid by a factor of $K$ both vertically and horizontally to create a grid with $NK$ rows and $NK$ columns.
Formally, output a grid $B$ with $NK$ rows and $NK$ columns that satisfies the following.
- For all $(i, j)$ such that $0 \leqq i, j < NK $, $B_{i, j} = A_{\lfloor i/K \rfloor, \lfloor j/K \rfloor}$ holds.
Input
The input is given from standard input in the following format.
$N$ $K$
$A_{0, 0}$$A_{0, 1}$$\cdots$$A_{0, N-1}$
$A_{1, 0}$$A_{1, 1}$$\cdots$$A_{1, N-1}$
$\vdots$
$A_{N-1, 0}$$A_{N-1, 1}$$\cdots$$A_{N-1, N-1}$
- $N, K$ are integers.
- $1 \leqq N, K \leqq 10$
- $ A_{i,j} $ is
.or#.
Output
Output the grid $B$ with $NK$ rows and $NK$ columns that satisfies the problem's conditions, in the following format.
$B_{0, 1}$$B_{0, 1}$$\cdots$$B_{0, NK-1}$
$B_{1, 0}$$B_{1, 1}$$\cdots$$B_{1, NK-1}$
$\vdots$
$B_{NK-1, 0}$$B_{NK-1, 1}$$\cdots$$B_{NK-1, NK-1}$
Sample
Sample 1
Input
3 2 .#. #.# .#.
Output
..##.. ..##.. ##..## ##..## ..##.. ..##..
The input grid is enlarged by a factor of 2 both vertically and horizontally.
Sample 2
Input
2 1 .# #.
Output
.# #.
The output grid may be the same as the input.
Sample 3
Input
6 3 ##..## ##..## ..##.. ..##.. .####. .#..#.
Output
######......###### ######......###### ######......###### ######......###### ######......###### ######......###### ......######...... ......######...... ......######...... ......######...... ......######...... ......######...... ...############... ...############... ...############... ...###......###... ...###......###... ...###......###...
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。