結果

問題 No.1087 転倒数の転倒数
ユーザー tyawanmusityawanmusi
提出日時 2020-05-19 15:39:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 638 bytes
コンパイル時間 331 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 97,920 KB
最終ジャッジ日時 2024-04-24 19:49:32
合計ジャッジ時間 17,841 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,624 KB
testcase_01 AC 26 ms
10,880 KB
testcase_02 AC 27 ms
10,752 KB
testcase_03 AC 26 ms
10,624 KB
testcase_04 AC 27 ms
10,752 KB
testcase_05 AC 26 ms
10,624 KB
testcase_06 AC 27 ms
10,752 KB
testcase_07 AC 27 ms
10,624 KB
testcase_08 AC 26 ms
10,624 KB
testcase_09 AC 27 ms
10,880 KB
testcase_10 AC 28 ms
10,752 KB
testcase_11 AC 27 ms
10,752 KB
testcase_12 AC 745 ms
97,792 KB
testcase_13 AC 26 ms
10,624 KB
testcase_14 AC 31 ms
10,880 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 474 ms
19,072 KB
testcase_18 AC 27 ms
10,624 KB
testcase_19 AC 27 ms
10,624 KB
testcase_20 AC 31 ms
10,880 KB
testcase_21 AC 615 ms
80,896 KB
testcase_22 AC 27 ms
10,624 KB
testcase_23 AC 29 ms
10,752 KB
testcase_24 AC 79 ms
15,232 KB
testcase_25 AC 566 ms
74,752 KB
testcase_26 AC 536 ms
68,736 KB
testcase_27 AC 376 ms
46,464 KB
testcase_28 AC 340 ms
43,904 KB
testcase_29 AC 264 ms
15,104 KB
testcase_30 AC 143 ms
12,928 KB
testcase_31 AC 360 ms
16,640 KB
testcase_32 AC 363 ms
16,640 KB
testcase_33 AC 231 ms
14,464 KB
testcase_34 AC 791 ms
97,664 KB
testcase_35 AC 1,016 ms
97,152 KB
testcase_36 AC 783 ms
97,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# writer解(リベンジ1+1+1回目)
# PEP8なにもわからん
# オタクくんさぁ......writer解何回も間違えるなよ......
n, k = map(int, input().split())
if k > n*(n-1):
    print("No")
    exit()
if k == 1:
    print("No")
    exit()
ans = [n*[0] for _ in range(n)]
if k >= 2*(n-1):
    q = []
    for i in range(n):
        ans[i][i] = 1
    for i in range(n-2, 0, -1):
        for j in range(i-1, -1, -1):
            q.append((i, j))
            q.append((j, i))
    for i in range(n*(n-1)-k):
        ans[q[i][0]][q[i][1]] = 1
elif k > 1:
    ans[n-1-k//2][n-1-(0--k//2)] = 1
print("Yes")
for i in ans:
    print(*i)
0