結果
問題 | No.1449 新プロランド |
ユーザー | lloyz |
提出日時 | 2022-08-21 14:58:44 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 227 ms / 2,000 ms |
コード長 | 754 bytes |
コンパイル時間 | 283 ms |
コンパイル使用メモリ | 10,880 KB |
実行使用メモリ | 11,608 KB |
最終ジャッジ日時 | 2023-08-25 16:54:04 |
合計ジャッジ時間 | 3,554 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 19 ms
8,580 KB |
testcase_01 | AC | 20 ms
8,676 KB |
testcase_02 | AC | 40 ms
8,840 KB |
testcase_03 | AC | 22 ms
8,604 KB |
testcase_04 | AC | 24 ms
8,692 KB |
testcase_05 | AC | 212 ms
11,280 KB |
testcase_06 | AC | 133 ms
10,484 KB |
testcase_07 | AC | 70 ms
9,736 KB |
testcase_08 | AC | 137 ms
10,912 KB |
testcase_09 | AC | 102 ms
9,456 KB |
testcase_10 | AC | 79 ms
9,880 KB |
testcase_11 | AC | 39 ms
9,432 KB |
testcase_12 | AC | 125 ms
10,736 KB |
testcase_13 | AC | 101 ms
9,656 KB |
testcase_14 | AC | 35 ms
9,412 KB |
testcase_15 | AC | 148 ms
10,648 KB |
testcase_16 | AC | 93 ms
9,936 KB |
testcase_17 | AC | 110 ms
10,228 KB |
testcase_18 | AC | 19 ms
8,588 KB |
testcase_19 | AC | 22 ms
9,172 KB |
testcase_20 | AC | 20 ms
8,648 KB |
testcase_21 | AC | 47 ms
9,460 KB |
testcase_22 | AC | 31 ms
8,856 KB |
testcase_23 | AC | 67 ms
9,960 KB |
testcase_24 | AC | 84 ms
9,252 KB |
testcase_25 | AC | 20 ms
8,644 KB |
testcase_26 | AC | 20 ms
8,708 KB |
testcase_27 | AC | 227 ms
11,608 KB |
testcase_28 | AC | 157 ms
10,164 KB |
ソースコード
from heapq import heapify, heappop, heappush from collections import defaultdict n, m = map(int, input().split()) edge = defaultdict(list) max_c = 0 for _ in range(m): a, b, c = map(int, input().split()) a -= 1 b -= 1 max_c = max(max_c, c) edge[a].append((b, c)) edge[b].append((a, c)) T = list(map(int, input().split())) INF = 10**18 D = [[INF for _ in range(max_c + 2)] for _ in range(n)] D[0][0] = 0 H = [(0, 0, 0)] heapify(H) while H: t, cp, et = heappop(H) if D[cp][et] < t: continue t += T[cp] et = min(et + T[cp], max_c + 1) for np, tt in edge[cp]: if D[np][et] > t + tt // et: D[np][et] = t + tt // et heappush(H, (t + tt // et, np, et)) print(min(D[n - 1]))