F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

8-bit Zoom

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 683    Accepted Submission(s): 315


Problem Description
You are given a picture with size $n\times 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 $\frac{nZ}{100}\times \frac{nZ}{100}$. A picture can not be zoomed in 8-bit style if and only if any of the following holds:
- $\frac{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.
 

Input
The first line contains a single integer $T$ ($1 \leq T \leq 10$), the number of test cases. For each test case:

The first line contains two integers $n$ and $Z$ ($1\leq n\leq 50$, $100\leq Z\leq 200$, $Z\bmod25=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)$.
 

Output
For each test case, if the picture can not be zoomed, print ''$\texttt{error}$'' in a line, otherwise print $\frac{nZ}{100}$ lines, each line contains a string of length $\frac{nZ}{100}$, denoting the resulting picture.
 

Sample Input
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
 

Sample Output
ab cd aabb aabb ccdd ccdd error error aaaaa aaaaa aaaaa aaaaa aaaaa
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 23:55:04, Gzip enabled