結果
| 問題 |
No.1880 Many Ways
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 21:30:52 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,254 bytes |
| コンパイル時間 | 207 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 52,736 KB |
| 最終ジャッジ日時 | 2025-06-12 21:31:36 |
| 合計ジャッジ時間 | 14,547 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 8 |
ソースコード
def main():
import sys
A = int(sys.stdin.readline())
if A == 0:
print("2 0")
elif A == 1:
print("1 0")
else:
if A <= 126:
N = A + 2
M = 2 * A
print(N, M)
# Add edges from 1 to each intermediate
for i in range(2, A + 2):
print(1, i)
# Add edges from each intermediate to N
for i in range(2, A + 2):
print(i, A + 2)
else:
# For A > 126, we need another approach
# Let's handle A as a product of factors, trying to fit within N=128
# Example: For A=127, we can have node 1 connected to 2-128, each connected to 128
# This gives 127 paths
N = 128
# Number of intermediate nodes is 127 (from 2 to 128)
# Each connected to 128
M = 127 + 127 # 127 edges from 1 and 127 edges to 128
print(N, M)
# Add edges from 1 to 2-128
for i in range(2, 129):
print(1, i)
# Add edges from 2-127 to 128 (node 128 can't connect to itself)
for i in range(2, 128):
print(i, 128)
if __name__ == "__main__":
main()
gew1fw