結果
| 問題 | No.1 道のショートカット |
| コンテスト | |
| ユーザー |
maatanbeta
|
| 提出日時 | 2017-05-19 16:02:22 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 580 ms / 5,000 ms |
| + 53µs | |
| コード長 | 676 bytes |
| 記録 | |
| コンパイル時間 | 60 ms |
| コンパイル使用メモリ | 14,976 KB |
| 実行使用メモリ | 13,836 KB |
| 最終ジャッジ日時 | 2026-10-13 10:26:17 |
| 合計ジャッジ時間 | 6,808 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 42 |
ソースコード
N = int(input())
C = int(input())
V = int(input())
S = list(map(int, input().split()))
T = list(map(int, input().split()))
Y = list(map(int, input().split()))
M = list(map(int, input().split()))
dic = {}
def sum_time(t, y):
if (t, y) in dic:
return dic[(t, y)]
if y < 0:
dic[(t, y)] = float("inf")
return dic[(t, y)]
if t == 1:
dic[(t, y)] = 0
return dic[(t, y)]
minm = float("inf")
for i in range(V):
if t == T[i]:
minm = min(sum_time(S[i], y-Y[i]) + M[i], minm)
dic[(t, y)] = minm
return dic[(t, y)]
M = sum_time(N, C)
if float("inf") > M >= 0:
print(M)
else:
print(-1)
maatanbeta