結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,624 KB
testcase_01 AC 31 ms
10,624 KB
testcase_02 AC 27 ms
10,752 KB
testcase_03 AC 28 ms
10,624 KB
testcase_04 WA -
testcase_05 AC 29 ms
10,624 KB
testcase_06 AC 28 ms
10,624 KB
testcase_07 AC 26 ms
10,624 KB
testcase_08 AC 27 ms
10,624 KB
testcase_09 AC 26 ms
10,752 KB
testcase_10 AC 27 ms
10,624 KB
testcase_11 AC 28 ms
10,624 KB
testcase_12 AC 772 ms
97,792 KB
testcase_13 AC 28 ms
10,752 KB
testcase_14 AC 31 ms
11,008 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 482 ms
18,944 KB
testcase_18 AC 27 ms
10,624 KB
testcase_19 AC 27 ms
10,752 KB
testcase_20 AC 31 ms
11,008 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 268 ms
15,104 KB
testcase_30 AC 144 ms
13,056 KB
testcase_31 AC 365 ms
16,640 KB
testcase_32 AC 361 ms
16,640 KB
testcase_33 AC 229 ms
14,592 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# writer解(リベンジ2回目)
# PEP8なにもわからん
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[j][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