結果
| 問題 |
No.1344 Typical Shortest Path Sum
|
| コンテスト | |
| ユーザー |
nasubi24
|
| 提出日時 | 2021-01-16 14:40:05 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 484 bytes |
| コンパイル時間 | 349 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 104,000 KB |
| 最終ジャッジ日時 | 2024-11-27 16:45:56 |
| 合計ジャッジ時間 | 81,809 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 TLE * 1 |
| other | WA * 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)
print(a)
a = np.array(a)
ans=shortest_path(a,method="J")
print(ans)
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