結果
| 問題 | No.3712 Urban Train |
| コンテスト | |
| ユーザー |
kidodesu
|
| 提出日時 | 2026-09-11 21:46:48 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 501 ms / 2,000 ms |
| + 597µs | |
| コード長 | 736 bytes |
| 記録 | |
| コンパイル時間 | 75 ms |
| コンパイル使用メモリ | 81,152 KB |
| 実行使用メモリ | 139,904 KB |
| 最終ジャッジ日時 | 2026-09-11 21:47:21 |
| 合計ジャッジ時間 | 7,536 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 39 |
ソースコード
n, m = list(map(int, input().split()))
node = [[] for _ in range(n)]
for _ in range(m):
u, v, w = list(map(lambda x: int(x)-1, input().split()))
node[u].append((v, w+1))
node[v].append((u, w+1))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
inf = 1<<60
D = [inf] * n
D[0] = 1
from heapq import heappush, heappop
hq = []
heappush(hq, (1, 0))
while hq:
c, u = heappop(hq)
if D[u] < c: continue
for v, w in node[u]:
k = (c+A[u]-1)//A[u]
if k % B[u] == 0:
nc = min(k*A[u]+w+C[u], k*A[u]+w+A[u])
else:
nc = k*A[u]+w
if D[v] > nc:
D[v] = nc
heappush(hq, (nc, v))
print(D[-1])
kidodesu