結果

問題 No.1587 012 Matrix
ユーザー shotoyooshotoyoo
提出日時 2021-07-08 22:52:36
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 117 ms / 1,000 ms
コード長 732 bytes
コンパイル時間 701 ms
コンパイル使用メモリ 86,952 KB
実行使用メモリ 79,052 KB
最終ジャッジ日時 2023-09-14 05:23:12
合計ジャッジ時間 4,039 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
71,192 KB
testcase_01 AC 80 ms
71,244 KB
testcase_02 AC 79 ms
71,304 KB
testcase_03 AC 79 ms
71,212 KB
testcase_04 AC 81 ms
71,304 KB
testcase_05 AC 79 ms
71,348 KB
testcase_06 AC 80 ms
71,164 KB
testcase_07 AC 81 ms
71,220 KB
testcase_08 AC 89 ms
76,464 KB
testcase_09 AC 92 ms
76,268 KB
testcase_10 AC 93 ms
76,136 KB
testcase_11 AC 93 ms
76,324 KB
testcase_12 AC 96 ms
76,048 KB
testcase_13 AC 98 ms
76,624 KB
testcase_14 AC 99 ms
76,540 KB
testcase_15 AC 100 ms
76,624 KB
testcase_16 AC 108 ms
78,584 KB
testcase_17 AC 111 ms
78,972 KB
testcase_18 AC 111 ms
79,052 KB
testcase_19 AC 109 ms
78,972 KB
testcase_20 AC 117 ms
78,968 KB
testcase_21 AC 115 ms
78,960 KB
testcase_22 AC 78 ms
71,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()

sys.setrecursionlimit(2*10**5+10)
write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")
writef = lambda x: print("{:.12f}".format(x))


n = int(input())
ans = [[0]*n for _ in range(n)]
for i in range(n):
    for j in range(n):
        if i>=j and i<n//2:
            ans[i][j] = 2
        elif i>=j and j<n//2:
            ans[i][j] = 2
        elif i>j:
            ans[i][j] = 2
        elif i==j:
            ans[i][j] = 1
s = set()
for i in range(n):
    v = v2 = 0
    for j in range(n):
        v += ans[i][j]
        v2 += ans[j][i]
    s.add(v)
    s.add(v2)
assert len(s)==2*n
for i in range(n):
    write("".join(map(str, ans[i])))
0