結果

問題 No.1449 新プロランド
ユーザー 小野寺健
提出日時 2021-05-02 15:27:25
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 621 bytes
コンパイル時間 221 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-12-24 02:07:43
合計ジャッジ時間 2,161 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

class Town:
    def __init__(self):
        self.T = None
        self.V = []
        self.M = float('inf')
        
N, M = map(int, input().split())
T = [Town() for _ in range(N)]
for _ in range(M):
    a, b, c = map(int, input().split())
    T[a-1].V.append((b-1, c))
    T[b-1].V.append((a-1, c))
for i, t in enumerate(list(map(int, input().split()))):
    T[i].T = t
    
q = [(0, 0, 0)]
while len(q) > 0:
    i, m, p = q.pop(0)
    t = T[i]
    p += t.T
    m += t.T
    for j, c in t.V:
        nt = T[j]
        if T[j].M > m+c/p:
            T[j].M = m+c/p
            q.append((j, m+c/p, p))
print(int(T[N-1].M))
0