結果
| 問題 |
No.1344 Typical Shortest Path Sum
|
| コンテスト | |
| ユーザー |
nasubi24
|
| 提出日時 | 2021-01-16 14:41:09 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 464 bytes |
| コンパイル時間 | 332 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 56,568 KB |
| 最終ジャッジ日時 | 2024-11-27 16:48:43 |
| 合計ジャッジ時間 | 70,701 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 77 |
ソースコード
from scipy.sparse.csgraph import shortest_path, johnson
from scipy.sparse import csr_matrix
import numpy as np
n,m=map(int,input().split())
a=[[10**18]*n for _ in range(n)]
for i in range(m):
s,t,d=map(int,input().split())
a[s-1][t-1]=min(a[s-1][t-1],d)
a = np.array(a)
ans=shortest_path(a,method="J")
for i in range(n):
m=0
for j in range(n):
if ans[i][j]>=10**15:
m+=0
else:
m+=int(ans[i][j])
print(m)
nasubi24