結果
| 問題 | No.3712 Urban Train |
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2026-09-12 03:11:06 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 532 ms / 2,000 ms |
| + 328µs | |
| コード長 | 1,177 bytes |
| 記録 | |
| コンパイル時間 | 76 ms |
| コンパイル使用メモリ | 81,280 KB |
| 実行使用メモリ | 146,696 KB |
| 最終ジャッジ日時 | 2026-09-12 03:11:24 |
| 合計ジャッジ時間 | 8,055 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 39 |
ソースコード
import sys
input = sys.stdin.readline
from heapq import heappop,heappush
N,M=list(map(int,input().split()))
E=[[] for i in range(N)]
for i in range(M):
u,v,w=list(map(int,input().split()))
u-=1
v-=1
E[u].append((v,w))
E[v].append((u,w))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
DIS=[(1<<64)-1]*N
DIS[0]=0
Q=[(0,0)]
while Q:
time,ind=heappop(Q)
if DIS[ind]!=time:
continue
k=(time+A[ind]-1)//A[ind]
if k==0:
k=1
if k%B[ind]==0:
plus=C[ind]
else:
plus=0
if plus==0:
start=k*A[ind]
for to,cost in E[ind]:
if DIS[to]>start+cost:
DIS[to]=start+cost
heappush(Q,(DIS[to],to))
else:
start=k*A[ind]
for to,cost in E[ind]:
if DIS[to]>start+cost+plus:
DIS[to]=start+cost+plus
heappush(Q,(DIS[to],to))
start=(k+1)*A[ind]
for to,cost in E[ind]:
if DIS[to]>start+cost:
DIS[to]=start+cost
heappush(Q,(DIS[to],to))
print(DIS[N-1])
titia