9011: 8-bit Zoom

内存限制:128 MB 时间限制:1 S
题面:传统 评测方式:文本比较 上传者:
提交:6 通过:4

题目描述

You are given a picture with size n×n. You need to output the zoomed picture with the zooming rate Z% in 8-bit style, or determine the picture can not be zoomed. Here in 8-bit style, the size of the result picture is (nZ/100)×(nZ/100). A picture can not be zoomed in 8-bit style if and only if any of the following holds:

  • nZ/100 is not an integer.
  • In the zoomed picture, the color of some pixels can not be determined. Note that there aren't any interpolation algorithm applied in 8-bit style, so when at least two different colors are mapped into the same pixel in the resulting picture, the color of this pixel is undetermined.

输入格式

The first line contains a single integer T (1T10), the number of test cases. For each test case:

The first line contains two integers n and Z (1n50100Z200Zmod25=0), denoting the size of the original picture and the zooming rate.

Each of the following n lines contains a string of length n, consisting of lowercase English letters. The j-th character in the i-th line denotes the color of the pixel located at (i,j).

输出格式

For each test case, if the picture can not be zoomed, print ''error'' in a line, otherwise print nZ/100 lines, each line contains a string of length nZ/100, denoting the resulting picture.


输入样例 复制

5
2 100
ab
cd
2 200
ab
cd
2 125
aa
aa
4 125
aaab
aaaa
aaaa
aaaa
4 125
aaaa
aaaa
aaaa
aaaa

输出样例 复制

ab
cd
aabb
aabb
ccdd
ccdd
error
error
aaaaa
aaaaa
aaaaa
aaaaa
aaaaa

分类标签