No tags yet

No tag edit access

The problem statement has recently been changed. View the changes.

×
time limit per test: 0.5 sec.

memory limit per test: 16000 KB

memory limit per test: 16000 KB

input: standard

output: standard

output: standard

You are given N*M matrix A. You are to find such matrix B, that B[i,j]=min{ A[x,y] : (y>=j) and (x>=i+j-y) }

On the first line of the input there are two integer numbers, N and M (1<=N,M<=1000). Then matrix A follows: next N lines contains M integers each (not greater than 32000 by absolute value). The j-th number on then i-th of this lines is A[i,j].

Write matrix B in the same format as matrix A, but without N and M.

Input

3 3

1 2 3

4 5 6

7 8 9

1 2 3

4 5 6

7 8 9

Output

1 2 3

2 3 6

3 6 9

2 3 6

3 6 9

Author: | NNSU #2 team |

Resource: | |

Date: |

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Mar/02/2021 08:50:07 (f1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|