結果

問題 No.1169 Row and Column and Diagonal
ユーザー shotoyooshotoyoo
提出日時 2020-08-14 21:42:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 395 bytes
コンパイル時間 453 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 81,988 KB
最終ジャッジ日時 2024-04-18 21:18:09
合計ジャッジ時間 2,053 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,096 KB
testcase_01 AC 37 ms
51,968 KB
testcase_02 AC 37 ms
52,096 KB
testcase_03 AC 36 ms
52,096 KB
testcase_04 AC 35 ms
51,968 KB
testcase_05 AC 37 ms
52,352 KB
testcase_06 AC 48 ms
62,080 KB
testcase_07 AC 47 ms
64,640 KB
testcase_08 AC 52 ms
67,712 KB
testcase_09 AC 53 ms
71,040 KB
testcase_10 AC 69 ms
81,152 KB
testcase_11 AC 71 ms
81,536 KB
testcase_12 AC 77 ms
81,988 KB
testcase_13 AC 71 ms
81,984 KB
testcase_14 AC 71 ms
81,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
ans = [[None]*n for _ in range(n)]
for i in range(n):
    ans[i][i] = i+1
for i in range(n):
    for j in range(1,n):
        ans[i][(i-j)%n] = ((i+1)+j) if i+j+1<=n else i+j+1-n
for i in range(n):
    write(" ".join(map(str, ans[i])))
0