結果
| 問題 | No.3712 Urban Train |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2026-09-11 22:42:59 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 580 ms / 2,000 ms |
| + 967µs | |
| コード長 | 966 bytes |
| 記録 | |
| コンパイル時間 | 73 ms |
| コンパイル使用メモリ | 80,896 KB |
| 実行使用メモリ | 138,300 KB |
| 最終ジャッジ日時 | 2026-09-11 22:43:21 |
| 合計ジャッジ時間 | 8,455 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 39 |
ソースコード
from heapq import heapify, heappop, heappush
INF = 2**64
N, M = [int(s) for s in input().split()]
graph = [[] for _ in range(N)]
for _ in range(M):
u, v, w = [int(s) for s in input().split()]
graph[u - 1].append((v - 1, w))
graph[v - 1].append((u - 1, w))
A = [int(s) for s in input().split()]
B = [int(s) for s in input().split()]
C = [int(s) for s in input().split()]
times = [INF] * N
times[0] = 0
visited = [False] * N
pq = [(A[0], 0)]
while pq:
time, curr = heappop(pq)
if visited[curr]:
continue
visited[curr] = True
for to, w in graph[curr]:
start = (time + A[curr] - 1) // A[curr] * A[curr]
ntime = start + w
if (start // A[curr]) % B[curr] == 0 and B[curr] >= 2:
nstart = start + A[curr]
ntime = min(ntime + C[curr], nstart + w)
if ntime >= times[to]:
continue
times[to] = ntime
heappush(pq, (ntime, to))
print(times[N - 1])