結果

問題 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  
実行時間 106 ms / 2,000 ms
コード長 305 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 10,728 KB
実行使用メモリ 13,620 KB
最終ジャッジ日時 2023-08-07 05:50:40
合計ジャッジ時間 2,372 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,800 KB
testcase_01 AC 15 ms
7,800 KB
testcase_02 AC 14 ms
7,716 KB
testcase_03 AC 45 ms
9,840 KB
testcase_04 AC 82 ms
12,176 KB
testcase_05 AC 15 ms
7,800 KB
testcase_06 AC 106 ms
13,536 KB
testcase_07 AC 15 ms
7,760 KB
testcase_08 AC 27 ms
8,816 KB
testcase_09 AC 47 ms
9,880 KB
testcase_10 AC 79 ms
11,660 KB
testcase_11 AC 15 ms
7,716 KB
testcase_12 AC 101 ms
13,208 KB
testcase_13 AC 105 ms
13,492 KB
testcase_14 AC 106 ms
13,508 KB
testcase_15 AC 103 ms
13,620 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