結果

問題 No.1087 転倒数の転倒数
ユーザー tyawanmusityawanmusi
提出日時 2020-05-19 14:02:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 482 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 98,048 KB
最終ジャッジ日時 2024-04-24 19:48:01
合計ジャッジ時間 18,565 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,752 KB
testcase_01 AC 26 ms
10,752 KB
testcase_02 AC 26 ms
10,752 KB
testcase_03 AC 26 ms
10,752 KB
testcase_04 AC 27 ms
10,880 KB
testcase_05 AC 26 ms
10,880 KB
testcase_06 AC 25 ms
10,624 KB
testcase_07 AC 25 ms
10,752 KB
testcase_08 AC 27 ms
10,752 KB
testcase_09 AC 26 ms
10,624 KB
testcase_10 AC 26 ms
10,624 KB
testcase_11 AC 26 ms
10,752 KB
testcase_12 AC 725 ms
98,048 KB
testcase_13 AC 26 ms
10,752 KB
testcase_14 AC 35 ms
11,776 KB
testcase_15 AC 25 ms
10,752 KB
testcase_16 AC 35 ms
11,776 KB
testcase_17 AC 923 ms
97,920 KB
testcase_18 AC 27 ms
10,752 KB
testcase_19 AC 26 ms
10,880 KB
testcase_20 WA -
testcase_21 AC 617 ms
81,024 KB
testcase_22 AC 26 ms
10,752 KB
testcase_23 AC 26 ms
10,752 KB
testcase_24 AC 75 ms
15,360 KB
testcase_25 AC 560 ms
74,880 KB
testcase_26 AC 512 ms
68,992 KB
testcase_27 AC 360 ms
46,592 KB
testcase_28 AC 340 ms
43,904 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 757 ms
97,920 KB
testcase_35 AC 887 ms
97,408 KB
testcase_36 AC 798 ms
97,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# writer解
n, k = map(int, input().split())
if k > n * (n - 1):
    print("No")
    exit()
ans = [n*[0] for _ in range(n)]
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-1, n):
    for j in range(n-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
print("Yes")
for i in ans:
    print(*i)
0