結果
| 問題 | No.3616 WK vs AT vs MT vs SP |
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2026-08-13 02:23:12 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 1,401 ms / 2,000 ms |
| + 73µs | |
| コード長 | 2,290 bytes |
| 記録 | |
| コンパイル時間 | 226 ms |
| コンパイル使用メモリ | 96,100 KB |
| 実行使用メモリ | 149,700 KB |
| 最終ジャッジ日時 | 2026-08-13 02:23:41 |
| 合計ジャッジ時間 | 22,923 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| サンプル | 0 % | AC * 1 |
| 小課題1 | 8 % | AC * 9 |
| 小課題2 | 16 % | AC * 5 |
| 小課題3 | 20 % | AC * 10 |
| 小課題4 | 20 % | AC * 15 |
| 小課題5 | 20 % | AC * 15 |
| 小課題6 | 16 % | AC * 36 |
| 合計 | 2.5 * 100% = 250 点 |
ソースコード
import sys
input = sys.stdin.readline
from heapq import heappop,heappush
N,R,C=list(map(int,input().split()))
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
Z=list(map(int,input().split()))
S=list(map(int,input().split()))
X.append(1<<63)
Y.append(1<<63)
Z.append(1<<63)
S.append(1<<63)
E=[[] for i in range(N+1)]
for i in range(R):
u,v,w,a,m=list(map(int,input().split()))
u-=1
v-=1
E[u].append((v,w,a,m))
E[v].append((u,w,a,m))
DP=[[[1<<63]*(N+1) for i in range(2)] for j in range(3)]
DP[0][0][0]=0
Q=[]
Q.append((0,0,0,0))
while Q:
time,car,ship,ind=heappop(Q)
if DP[car][ship][ind]!=time:
continue
if car==0:
if DP[1][ship][ind]>time+X[ind]:
DP[1][ship][ind]=time+X[ind]
heappush(Q,(DP[1][ship][ind],1,ship,ind))
if DP[2][ship][ind]>time+Y[ind]:
DP[2][ship][ind]=time+Y[ind]
heappush(Q,(DP[2][ship][ind],2,ship,ind))
if car==1:
if DP[2][ship][ind]>time+Y[ind]:
DP[2][ship][ind]=time+Y[ind]
heappush(Q,(DP[2][ship][ind],2,ship,ind))
if ship==0:
if DP[car][1][ind]>time+Z[ind]:
DP[car][1][ind]=time+Z[ind]
heappush(Q,(DP[car][1][ind],car,1,ind))
for to,w,a,m in E[ind]:
if DP[car][ship][to]>time+w:
DP[car][ship][to]=time+w
heappush(Q,(DP[car][ship][to],car,ship,to))
if car>=1 and DP[car][ship][to]>time+a:
DP[car][ship][to]=time+a
heappush(Q,(DP[car][ship][to],car,ship,to))
if car==2 and DP[car][ship][to]>time+m:
DP[car][ship][to]=time+m
heappush(Q,(DP[car][ship][to],car,ship,to))
if ship==1:
if ind!=N:
if DP[car][ship][N]>time+S[ind]+C/2:
DP[car][ship][N]=time+S[ind]+C/2
heappush(Q,(DP[car][ship][N],car,ship,N))
else:
for i in range(N):
if DP[car][ship][i]>time+S[i]+C/2:
DP[car][ship][i]=time+S[i]+C/2
heappush(Q,(DP[car][ship][i],car,ship,i))
ANS=1<<63
for i in range(3):
for j in range(2):
ANS=min(ANS,DP[i][j][N-1])
print(round(ANS))
titia