結果

問題 No.1 道のショートカット
ユーザー ああいいああいい
提出日時 2022-03-02 21:08:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 88 ms / 5,000 ms
コード長 667 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 76,820 KB
最終ジャッジ日時 2023-09-23 12:08:24
合計ジャッジ時間 5,390 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,412 KB
testcase_01 AC 69 ms
71,620 KB
testcase_02 AC 69 ms
71,324 KB
testcase_03 AC 67 ms
71,212 KB
testcase_04 AC 70 ms
71,320 KB
testcase_05 AC 67 ms
71,308 KB
testcase_06 AC 67 ms
71,516 KB
testcase_07 AC 68 ms
71,328 KB
testcase_08 AC 84 ms
76,684 KB
testcase_09 AC 81 ms
76,668 KB
testcase_10 AC 80 ms
76,640 KB
testcase_11 AC 81 ms
76,672 KB
testcase_12 AC 88 ms
76,820 KB
testcase_13 AC 87 ms
76,736 KB
testcase_14 AC 73 ms
75,904 KB
testcase_15 AC 70 ms
75,684 KB
testcase_16 AC 77 ms
76,552 KB
testcase_17 AC 76 ms
76,032 KB
testcase_18 AC 78 ms
76,332 KB
testcase_19 AC 78 ms
76,076 KB
testcase_20 AC 78 ms
76,732 KB
testcase_21 AC 80 ms
76,208 KB
testcase_22 AC 78 ms
76,192 KB
testcase_23 AC 83 ms
76,716 KB
testcase_24 AC 83 ms
76,744 KB
testcase_25 AC 83 ms
76,620 KB
testcase_26 AC 78 ms
76,220 KB
testcase_27 AC 83 ms
76,644 KB
testcase_28 AC 74 ms
76,104 KB
testcase_29 AC 87 ms
76,784 KB
testcase_30 AC 74 ms
76,548 KB
testcase_31 AC 78 ms
76,604 KB
testcase_32 AC 83 ms
76,448 KB
testcase_33 AC 81 ms
76,616 KB
testcase_34 AC 83 ms
76,664 KB
testcase_35 AC 72 ms
76,364 KB
testcase_36 AC 77 ms
76,560 KB
testcase_37 AC 74 ms
76,608 KB
testcase_38 AC 74 ms
76,136 KB
testcase_39 AC 77 ms
76,108 KB
testcase_40 AC 72 ms
76,700 KB
testcase_41 AC 74 ms
76,000 KB
testcase_42 AC 67 ms
71,584 KB
testcase_43 AC 71 ms
75,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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()))
G = [[] for _ in range(N+1)]
for i in range(V):
    G[S[i]].append((T[i],Y[i],M[i]))
inf = 1 << 30
dp = [[inf] * (C + 1) for _ in range(N+1)]
dp[1][0] = 0
for i in range(1,N+1):
    for c in range(C+1):
        for t,y,cc in G[i]:
            if c + y <= C:
                if dp[t][c+y] > dp[i][c] + cc:
                    dp[t][c+y] = dp[i][c] + cc
_min = inf
for c in range(C+1):
    if dp[-1][c] < _min:
        _min = dp[-1][c]
if _min == inf:
    _min = -1
print(_min)
0