結果

問題 No.1449 新プロランド
ユーザー 小野寺健小野寺健
提出日時 2021-05-02 15:27:25
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 621 bytes
コンパイル時間 416 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 8,004 KB
最終ジャッジ日時 2023-08-25 16:53:05
合計ジャッジ時間 1,829 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,868 KB
testcase_01 AC 15 ms
7,816 KB
testcase_02 AC 15 ms
7,760 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 15 ms
7,900 KB
testcase_10 WA -
testcase_11 AC 15 ms
7,876 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 16 ms
8,004 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 15 ms
7,844 KB
testcase_19 AC 16 ms
7,952 KB
testcase_20 AC 15 ms
7,832 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 15 ms
8,000 KB
testcase_24 AC 16 ms
7,836 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

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