結果
| 問題 |
No.1737 One to N
|
| コンテスト | |
| ユーザー |
hiragn
|
| 提出日時 | 2022-11-03 02:41:46 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 672 bytes |
| コンパイル時間 | 390 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-07-17 13:56:44 |
| 合計ジャッジ時間 | 2,356 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 3 |
| other | RE * 27 |
ソースコード
import networkx as nx
def make_divisors(n):
lower_divisors, upper_divisors = [], []
i = 1
while i * i <= n:
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_divisors.append(n // i)
i += 1
return lower_divisors + upper_divisors[::-1]
def main():
n = int(input())
div_lst = make_divisors(n)
graph = nx.Graph()
for i in div_lst:
for j in div_lst:
if i == j:
continue
if j % i == 0:
graph.add_edge(i, j, weight=j // i)
print(nx.dijkstra_path_length(graph, 1, n))
if __name__ == "__main__":
main()
hiragn