結果

問題 No.1449 新プロランド
ユーザー 小野寺健小野寺健
提出日時 2021-05-02 16:37:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 728 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 14,900 KB
最終ジャッジ日時 2023-08-25 16:53:10
合計ジャッジ時間 5,360 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
14,900 KB
testcase_01 AC 16 ms
7,820 KB
testcase_02 AC 16 ms
7,844 KB
testcase_03 AC 31 ms
8,500 KB
testcase_04 AC 16 ms
7,804 KB
testcase_05 AC 82 ms
8,788 KB
testcase_06 AC 17 ms
7,952 KB
testcase_07 AC 16 ms
7,828 KB
testcase_08 AC 22 ms
8,272 KB
testcase_09 AC 16 ms
7,816 KB
testcase_10 AC 16 ms
7,824 KB
testcase_11 AC 15 ms
7,896 KB
testcase_12 AC 607 ms
10,840 KB
testcase_13 AC 16 ms
7,800 KB
testcase_14 AC 15 ms
7,844 KB
testcase_15 AC 16 ms
7,808 KB
testcase_16 AC 16 ms
7,896 KB
testcase_17 AC 32 ms
8,544 KB
testcase_18 AC 16 ms
7,752 KB
testcase_19 AC 16 ms
7,900 KB
testcase_20 AC 16 ms
7,804 KB
testcase_21 AC 16 ms
7,900 KB
testcase_22 AC 16 ms
7,808 KB
testcase_23 AC 16 ms
7,840 KB
testcase_24 AC 16 ms
7,816 KB
testcase_25 AC 18 ms
8,320 KB
testcase_26 AC 15 ms
7,824 KB
testcase_27 TLE -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

class Town:
    def __init__(self):
        self.T = None
        self.V = []
    def __str__(self):
        return "T:" + str(self.T) + ",V:" + str(self.V)
        
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
    
G = float('inf')    
    
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 G > m+c//p:
            if j == N-1:
                G = m+c//p
            else:
                q.append((j, m+c//p, p))
print(G)
0