AT_arc214_d [ARC214D] Distinct Sum Grid Path

Description

There is an $ N \times N $ grid. Let $ (i,j) $ denote the cell at the $ i $ -th row from the top and $ j $ -th column from the left. Output one way to write a non-negative integer in each cell so that the following condition is satisfied. > For a path from cell $ (1,1) $ to cell $ (N,N) $ by repeating moves only to adjacent cells to the right or down, let the **score** of the path be the sum of the integers written in the cells on the path (including the start and end points). > Then, for all $ \binom{2N-2}{N-1} $ possible paths, the scores are all distinct and all at most $ 6 \times 10^6 $ .

Input Format

The input is given from Standard Input in the following format: > $ N $

Output Format

For a way of writing that satisfies the condition in the problem statement, let $ A_{i,j} $ be the non-negative integer written in cell $ (i,j) $ , and output it in the following format: > $ A_{1,1} $ $ A_{1,2} $ $ \ldots $ $ A_{1,N} $ > > $ A_{2,1} $ $ A_{2,2} $ $ \ldots $ $ A_{2,N} $ > > $ \vdots $ > > $ A_{N,1} $ $ A_{N,2} $ $ \ldots $ $ A_{N,N} $ If there are multiple solutions, any of them will be accepted.

Explanation/Hint

### Sample Explanation 1 The score of the path that moves right then down is $ 7 $ , and the score of the path that moves down then right is $ 8 $ , satisfying the condition in the problem statement. ### Constraints - $ 2 \le N \le 13 $