AtCoder Regular Contest 214
D
不同和的网格路径
Distinct Sum Grid Path
AtCoder
⌀ 2205
原题
← CE →

不同和的网格路径AI (CI翻译)

Problem Statement

题目描述

AI (CI翻译)

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.

有一个 $N \times N$ 的网格。令 $(i,j)$ 表示从上往下数第 $i$ 行、从左往右数第 $j$ 列的单元格。AI (CI翻译)

Output one way to write a non-negative integer in each cell so that the following condition is satisfied.

请在每个单元格中写入一个非负整数,使其满足以下条件。AI (CI翻译)

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$.

对于一条从单元格 $(1,1)$ 出发、通过重复向右或向下移动到达单元格 $(N,N)$ 的路径,定义该路径的得分为路径上所有单元格中所写整数之和(包括起点和终点)。

对于全部 $inom{2N-2}{N-1}$ 条可能的路径,它们的得分均互不相同,且均不超过 $6 \times 10^6$。

AI (CI翻译)

Constraints

约束条件

AI (CI翻译)
  • $2 \le N \le 13$
  • $2 \le N \le 13$
AI (CI翻译)

Input

输入格式

AI (CI翻译)

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

输入从标准输入按以下格式给出:AI (CI翻译)

N

N
AI (CI翻译)

Output

输出格式

AI (CI翻译)

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_{i,j}$ 表示写在单元格 $(i,j)$ 中的非负整数。请输出一种满足题目描述中条件的写法,格式如下:AI (CI翻译)

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}

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}
AI (CI翻译)

If there are multiple solutions, any of them will be accepted.

如果有多种解,输出其中任意一种即可。AI (CI翻译)

样例

Input #1
2
Output #1
1 2
3 4
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.
Input #2
5
Output #2
10443 257776 131299 258759 153153
103533 63158 120370 132605 22808
206213 155047 237224 121264 96487
213665 51789 237311 239387 27085
229301 125534 154776 40898 210765
题目信息
题号
arc214_d
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。