Author: | A. Klenin | Time limit: | 5 sec | |
Input file: | input.txt | Memory limit: | 200 Mb | |
Output file: | output.txt |
Input is the matrix A of N by N non-negative integers.
A distance between two elements Ai j and Ap q is defined as |i − p| + |j − q|.
Your program must replace each zero element in the matrix with the nearest non-zero one. If there are two or more nearest non-zeroes, the zero must be left in place.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|