結果
| 問題 | No.3616 WK vs AT vs MT vs SP |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2026-08-21 22:52:38 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,310 bytes |
| 記録 | |
| コンパイル時間 | 555 ms |
| コンパイル使用メモリ | 95,980 KB |
| 実行使用メモリ | 192,712 KB |
| 最終ジャッジ日時 | 2026-08-21 22:52:58 |
| 合計ジャッジ時間 | 18,794 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_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 * 33 WA * 3 |
| 合計 | 2.5 * 84% = 210 点 |
ソースコード
from heapq import heappop, heappush
INF = 10**18
def dijkstra(start: int, graph: list[list[tuple[int, int]]]):
n = len(graph)
pq = [(0, start)]
dist = [INF] * n
dist[start] = 0
while pq:
d, curr = heappop(pq)
if d > dist[curr]:
continue
for to, cost in graph[curr]:
nd = dist[curr] + cost
if dist[to] <= nd:
continue
heappush(pq, (nd, to))
dist[to] = nd
return dist
N, R, C = [int(s) for s in input().split()]
X = [int(s) for s in input().split()]
Y = [int(s) for s in input().split()]
Z = [int(s) for s in input().split()]
S = [int(s) for s in input().split()]
graph = [[] for _ in range(6 * N + 6)]
wk, at, mt, sp = 0, N, 2 * N, 3 * N
for i in range(N):
# オートマ免許
graph[i + wk].append((i + at, X[i]))
graph[i + wk + sp].append((i + at + sp, X[i]))
# マニュアル免許
graph[i + wk].append((i + mt, Y[i]))
graph[i + at].append((i + mt, Y[i]))
graph[i + wk + sp].append((i + mt + sp, Y[i]))
graph[i + at + sp].append((i + mt + sp, Y[i]))
# 船舶免許
graph[i + wk].append((i + wk + sp, Z[i]))
graph[i + at].append((i + at + sp, Z[i]))
graph[i + mt].append((i + mt + sp, Z[i]))
for _ in range(R):
U, V, W, A, M = [int(s) for s in input().split()]
U -= 1
V -= 1
# 徒歩
for walk in (wk, at, mt, wk + sp, at + sp, mt + sp):
graph[U + walk].append((V + walk, W))
graph[V + walk].append((U + walk, W))
# オートマ車
for auto in (at, mt, at + sp, mt + sp):
graph[U + auto].append((V + auto, A))
graph[V + auto].append((U + auto, A))
# マニュアル車
for manu in (mt, mt + sp):
graph[U + manu].append((V + manu, M))
graph[V + manu].append((U + manu, A))
# 船舶
for i in range(N):
for idx, ship in enumerate((wk + sp, at + sp, mt + sp)):
super_u, super_v = 6 * N + 2 * idx, 6 * N + 2 * idx + 1
graph[i + ship].append((super_u, S[i]))
graph[super_v].append((i + ship, S[i]))
for idx in range(3):
super_u, super_v = 6 * N + 2 * idx, 6 * N + 2 * idx + 1
graph[super_u].append((super_v, C))
dist = dijkstra(0, graph)
ans = min(dist[N - 1 + N * i] for i in range(6))
print(ans)