結果

問題 No.1519 Diversity
ユーザー qwewe
提出日時 2025-05-14 12:49:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 497 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 82,112 KB
実行使用メモリ 87,520 KB
最終ジャッジ日時 2025-05-14 12:51:10
合計ジャッジ時間 4,535 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 2 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
edges = []

if n == 2:
    edges.append((1, 2))
elif n == 3:
    edges.append((1, 3))
    edges.append((2, 3))
else:
    # Connect vertex 1 to all others
    for i in range(2, n+1):
        edges.append((1, i))
    # Connect each vertex i (3 <= i <= n-1) to vertices 2..i-1
    for i in range(3, n):
        for j in range(2, i):
            edges.append((i, j))
    # Vertex n is connected only to 1, which is already handled

print(len(edges))
for u, v in edges:
    print(u, v)
0