시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
3 초 | 128 MB | 100 | 67 | 32 | 72.727% |
There are given:
If [i,j] and [i’,j’] are two positions in the table F, the distance between them is max(|i-i’|,|j-j’|).
The table W, n x n, should be computed, where W[i,j] (the number in i-th column and j-th line of the table W) is equal to the sum of all the numbers F[x,y], such that the distance between [x,y] and [i,j] is not greater than r.
Write a program, which:
In the first line of standard input there are two positive integers separated by a single space: n and r, where 0 ≤ r < n ≤ 250. In the following n lines the table F is described. Each of these lines contains n integers from the set {0,1}, separated by single spaces. The i-th number written in (j+1)-st line is equal to F[i,j].
The standard output should contain exactly n lines. In the j-th line the values W[1,j]…W[n,j] should be written respectively; they should be separated by single spaces.
5 1 1 0 0 0 1 1 1 1 0 0 1 0 0 0 0 0 0 0 1 1 0 1 0 0 0
3 4 2 2 1 4 5 2 2 1 3 4 3 3 2 2 2 2 2 2 1 1 2 2 2