시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 106 | 17 | 15 | 24.194% |
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.
Input file contains the number N followed by N2 integers, representing the matrix rowby-row.
Output file must contain N2 integers, representing the modified matrix row-by-row.
3 0 0 0 1 0 2 0 3 0
1 0 2 1 0 2 0 3 0
ICPC > Regionals > Northern Eurasia > Far Eastern Russia Regional Contest > NEERC Far-Eastern Subregional 2003 A번