結果
| 問題 |
No.1 道のショートカット
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-02-12 14:51:08 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 823 bytes |
| コンパイル時間 | 171 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 17,828 KB |
| 最終ジャッジ日時 | 2024-09-28 18:02:02 |
| 合計ジャッジ時間 | 10,375 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 6 WA * 1 TLE * 1 -- * 32 |
ソースコード
def intm(string):
return int(string) - 1
# return minimum time to N
def goforward(start, curcost, curtime):
if start == N - 1:
return curtime
smallest = 1e+10
for i in range(V):
if S[i] == start:
nexcost = curcost + Y[i]
nextime = curtime + M[i]
if nexcost > C:continue
result = goforward(T[i], nexcost, nextime)
#print("{} -> {} :{}".format(start, T[i], result))
smallest = min(smallest, result)
return smallest
N = int(input())
C = int(input())
V = int(input())
S = list(map(intm, input().split(" ")))
T = list(map(intm, input().split(" ")))
Y = list(map(int, input().split(" ")))
M = list(map(int, input().split(" ")))
result = goforward(0, 0, 0)
if result >= 1e+9:
result = -1
print(goforward(0, 0, 0))