問題一覧 > 通常問題

No.2728 Grid Expansion

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 224
作問者 : kusirakusira / テスター : 👑 AngrySadEight FplusFplusF hiro1729 みどりむし🦠
お気に入りにしたユーザー ProblemId : 10755 / 自分の提出
問題文最終更新日: 2024-04-14 14:12:35
Grid Expansion
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
yukicoder contest 428 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。