Logo
(追記) (追記ここまで)

8029번 - Density Map 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 128 MB2091388667.188%

문제

There are given:

  • integers n > r ≥ 0,
  • F - the table n x n with the numbers from the set {0,1}; columns and lines of the table are numbered from 1 to n; the number in i-th column and j-th line of the table is denoted by F[i,j].

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:

  • reads integers n, r and the table F from the standard input,
  • computes the table W,
  • writes the table W to the standard output.

입력

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.

제한

예제 입력 1

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

예제 출력 1

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

힌트

출처

Olympiad > Polish Olympiad in Informatics > POI 2000/2001 > Stage 1 3번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /