結果
| 問題 |
No.1880 Many Ways
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 00:31:39 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,289 bytes |
| コンパイル時間 | 209 ms |
| コンパイル使用メモリ | 81,152 KB |
| 実行使用メモリ | 52,748 KB |
| 最終ジャッジ日時 | 2025-04-16 00:33:47 |
| 合計ジャッジ時間 | 15,209 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 8 |
ソースコード
def main():
import sys
A = int(sys.stdin.readline())
if A == 0:
print("2 0")
return
elif A == 1:
print("1 0")
return
factors = []
current = A
while current > 1:
found = False
start = min(current, 126)
for i in range(start, 1, -1):
if current % i == 0:
factors.append(i)
current = current // i
found = True
break
if not found:
factors.append(current)
break
sum_factors = sum(factors)
if sum_factors + 2 > 128:
print("Impossible case handled inadequately in this code.")
return
nodes = [[1]]
current_node = 1
for k in factors:
next_nodes = []
for _ in range(k):
current_node += 1
next_nodes.append(current_node)
nodes.append(next_nodes)
final_node = current_node + 1
nodes.append([final_node])
edges = []
for i in range(len(nodes) - 1):
for a in nodes[i]:
for b in nodes[i+1]:
edges.append((a, b))
N = final_node
M = len(edges)
print(N, M)
for a, b in edges:
print(a, b)
if __name__ == "__main__":
main()
lam6er