結果
| 問題 |
No.1519 Diversity
|
| コンテスト | |
| ユーザー |
qwewe
|
| 提出日時 | 2025-05-14 13:24:59 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 87 ms / 2,000 ms |
| コード長 | 569 bytes |
| コンパイル時間 | 177 ms |
| コンパイル使用メモリ | 82,408 KB |
| 実行使用メモリ | 81,384 KB |
| 最終ジャッジ日時 | 2025-05-14 13:25:53 |
| 合計ジャッジ時間 | 2,304 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 15 |
ソースコード
import sys
def main():
N = int(sys.stdin.readline())
edges = []
# Use 0-indexed vertices for logic (0 to N-1),
# then convert to 1-indexed for output (1 to N).
# Connect vertex i and vertex j if i < j and i + j >= N - 1
for i in range(N):
for j in range(i + 1, N): # Ensure i < j to avoid self-loops and duplicate edges
if i + j >= N - 1:
edges.append((i + 1, j + 1)) # Add 1 for 1-indexed output
print(len(edges))
for u, v in edges:
print(u, v)
if __name__ == '__main__':
main()
qwewe