CF42D.Strange town

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Volodya has recently visited a very odd town. There are NN 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.

输入格式

Input contains just one natural number ( 3<=N<=203<=N<=20 ) — the number of town attractions.

输出格式

Output should contain NN rows containing NN positive integer numbers each — the adjacency matrix of the prices graph (thus, jj -th number in ii -th row should be equal to the price of the road between the jj -th and the ii -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.

输入输出样例

  • 输入#1

    3
    

    输出#1

    0 3 4 
    3 0 5 
    4 5 0 
    
首页