結果

問題 No.1587 012 Matrix
ユーザー shotoyooshotoyoo
提出日時 2021-07-08 22:52:36
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 118 ms / 1,000 ms
コード長 732 bytes
コンパイル時間 846 ms
使用メモリ 83,604 KB
最終ジャッジ日時 2023-02-01 19:01:16
合計ジャッジ時間 4,692 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 82 ms
75,560 KB
testcase_01 AC 83 ms
75,716 KB
testcase_02 AC 83 ms
75,796 KB
testcase_03 AC 83 ms
75,920 KB
testcase_04 AC 85 ms
75,524 KB
testcase_05 AC 85 ms
75,776 KB
testcase_06 AC 83 ms
75,564 KB
testcase_07 AC 85 ms
75,524 KB
testcase_08 AC 91 ms
80,700 KB
testcase_09 AC 97 ms
80,876 KB
testcase_10 AC 100 ms
80,944 KB
testcase_11 AC 99 ms
80,736 KB
testcase_12 AC 102 ms
80,620 KB
testcase_13 AC 105 ms
81,228 KB
testcase_14 AC 108 ms
80,788 KB
testcase_15 AC 111 ms
82,688 KB
testcase_16 AC 113 ms
82,860 KB
testcase_17 AC 118 ms
82,816 KB
testcase_18 AC 118 ms
83,124 KB
testcase_19 AC 118 ms
83,340 KB
testcase_20 AC 118 ms
83,476 KB
testcase_21 AC 116 ms
83,604 KB
testcase_22 AC 83 ms
75,732 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