結果

問題 No.1519 Diversity
ユーザー tktk_snsntktk_snsn
提出日時 2021-05-28 21:51:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 305 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 16,256 KB
最終ジャッジ日時 2024-04-25 00:00:52
合計ジャッジ時間 2,544 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,880 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 32 ms
10,752 KB
testcase_03 AC 69 ms
12,288 KB
testcase_04 AC 117 ms
14,464 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 142 ms
16,256 KB
testcase_07 AC 30 ms
10,752 KB
testcase_08 AC 44 ms
11,264 KB
testcase_09 AC 70 ms
12,416 KB
testcase_10 AC 108 ms
14,336 KB
testcase_11 AC 30 ms
10,752 KB
testcase_12 AC 137 ms
15,872 KB
testcase_13 AC 142 ms
16,256 KB
testcase_14 AC 143 ms
16,128 KB
testcase_15 AC 140 ms
16,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
edge = []
deg = [0] * (N+1)

now = N
for d in range(1, N)[::-1]:
    add = d - deg[now]
    if add <= 0:
        break
    deg[now] = d
    for i in range(1, add+1):
        deg[now-i] += 1
        edge.append((now, now-i))
    now -= 1

print(len(edge))
for a, b in edge:
    print(a, b)
0