結果

問題 No.1 道のショートカット
ユーザー drymousedrymouse
提出日時 2024-02-12 14:51:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 823 bytes
コンパイル時間 1,175 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 16,788 KB
最終ジャッジ日時 2024-02-12 14:51:19
合計ジャッジ時間 10,484 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
9,984 KB
testcase_01 AC 28 ms
9,984 KB
testcase_02 AC 29 ms
9,984 KB
testcase_03 WA -
testcase_04 AC 28 ms
9,984 KB
testcase_05 AC 27 ms
9,984 KB
testcase_06 WA -
testcase_07 AC 27 ms
9,984 KB
testcase_08 AC 907 ms
10,112 KB
testcase_09 AC 78 ms
10,112 KB
testcase_10 AC 1,709 ms
10,112 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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))
0