結果
| 問題 |
No.1 道のショートカット
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-02-09 11:31:42 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 774 bytes |
| コンパイル時間 | 116 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 17,828 KB |
| 最終ジャッジ日時 | 2024-07-08 03:45:43 |
| 合計ジャッジ時間 | 6,955 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 RE * 1 |
| other | AC * 3 RE * 1 TLE * 1 -- * 35 |
ソースコード
#!/usr/bin/env python3
from collections import defaultdict
N = int(input())
C = int(input())
V = int(input())
S = [int(x) for x in input().split()]
T = [int(x) for x in input().split()]
Y = [int(x) for x in input().split()]
M = [int(x) for x in input().split()]
e = defaultdict(list)
for s, t, y, m in zip(S, T, Y, M):
e[t].append((s, y, m))
def path(e, max_cost, now):
if now == 1:
return {0: 0}
tmp = defaultdict(list)
for s, y, m in e[now]:
for cost, time in path(e, max_cost, s).items():
cost += y
time += m
if cost <= max_cost:
tmp[cost].append(time)
ret = {}
for cost, times in tmp.items():
ret[cost] = min(times)
return ret
print(min(path(e, C, N).values()))