奇怪的小镇AI (CI翻译)
Volodya has recently visited a very odd town. There are $*N*$ tourist attractions in the town and every two of them are connected by a bidirectional road. Each road has some travel price (natural number) assigned to it and all prices are distinct. But the most striking thing about this town is that each city sightseeing tour has the same total price! That is, if we choose any city sightseeing tour — a cycle which visits every attraction exactly once — the sum of the costs of the tour roads is independent of the tour. Volodya is curious if you can find such price system with all road prices not greater than 1000.
Volodya 最近参观了一个非常奇怪的小镇。小镇中有 $*N*$ 个旅游景点,任意两个景点之间都有一条双向道路相连。每条道路都被赋予了一个旅行价格(正整数),且所有价格互不相同。但这个小镇最引人注目的地方是,每次城市观光游览的总价格都相同!也就是说,如果我们选择任意一次城市观光游览——一条恰好访问每个景点一次的环——那么游览道路的费用总和与所选择的游览无关。Volodya 想知道,你是否能找到一个所有道路价格均不超过 1000 的价格系统。AI (CI翻译)
Input
输入格式
AI (CI翻译)Input contains just one natural number ($3 ≤ *N* ≤ 20$) — the number of town attractions.
输入仅包含一个正整数($3 ≤ *N* ≤ 20$)——小镇中景点的数量。AI (CI翻译)
Output
输出格式
AI (CI翻译)Output should contain $*N*$ rows containing $*N*$ positive integer numbers each — the adjacency matrix of the prices graph (thus, $*j*$-th number in $*i*$-th row should be equal to the price of the road between the $*j*$-th and the $*i*$-th attraction). Diagonal numbers should be equal to zero. All numbers should not be greater than 1000. All prices should be positive and pairwise distinct. If there are several solutions, output any of them.
输出应包含 $*N*$ 行,每行包含 $*N*$ 个正整数——价格图的邻接矩阵(因此,第 $*i*$ 行中的第 $*j*$ 个数应等于第 $*j*$ 个景点与第 $*i*$ 个景点之间道路的价格)。对角线上的数字应为零。所有数字均不得大于 1000。所有价格都必须为正数且两两不同。如果有多个解,输出任意一个即可。AI (CI翻译)
样例
3
0 3 4
3 0 5
4 5 0
题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。