結果

問題 No.1 道のショートカット
ユーザー convexineqconvexineq
提出日時 2020-12-04 21:45:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 94 ms / 5,000 ms
コード長 587 bytes
コンパイル時間 1,208 ms
コンパイル使用メモリ 86,948 KB
実行使用メモリ 76,632 KB
最終ジャッジ日時 2023-10-13 11:28:51
合計ジャッジ時間 7,776 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,180 KB
testcase_01 AC 73 ms
71,288 KB
testcase_02 AC 72 ms
71,360 KB
testcase_03 AC 71 ms
71,288 KB
testcase_04 AC 71 ms
71,020 KB
testcase_05 AC 71 ms
71,300 KB
testcase_06 AC 72 ms
71,264 KB
testcase_07 AC 72 ms
71,288 KB
testcase_08 AC 87 ms
76,264 KB
testcase_09 AC 84 ms
76,420 KB
testcase_10 AC 84 ms
76,456 KB
testcase_11 AC 90 ms
76,332 KB
testcase_12 AC 91 ms
76,436 KB
testcase_13 AC 92 ms
76,400 KB
testcase_14 AC 76 ms
75,448 KB
testcase_15 AC 74 ms
75,460 KB
testcase_16 AC 80 ms
76,340 KB
testcase_17 AC 75 ms
75,468 KB
testcase_18 AC 78 ms
75,452 KB
testcase_19 AC 74 ms
75,532 KB
testcase_20 AC 86 ms
76,408 KB
testcase_21 AC 79 ms
75,880 KB
testcase_22 AC 76 ms
75,448 KB
testcase_23 AC 89 ms
76,356 KB
testcase_24 AC 94 ms
76,508 KB
testcase_25 AC 85 ms
76,436 KB
testcase_26 AC 84 ms
76,016 KB
testcase_27 AC 90 ms
76,440 KB
testcase_28 AC 74 ms
75,568 KB
testcase_29 AC 86 ms
76,632 KB
testcase_30 AC 78 ms
76,232 KB
testcase_31 AC 81 ms
76,384 KB
testcase_32 AC 85 ms
76,368 KB
testcase_33 AC 86 ms
76,364 KB
testcase_34 AC 92 ms
76,428 KB
testcase_35 AC 76 ms
75,572 KB
testcase_36 AC 83 ms
76,376 KB
testcase_37 AC 80 ms
76,148 KB
testcase_38 AC 74 ms
75,584 KB
testcase_39 AC 75 ms
75,680 KB
testcase_40 AC 78 ms
76,404 KB
testcase_41 AC 73 ms
71,248 KB
testcase_42 AC 70 ms
71,336 KB
testcase_43 AC 73 ms
75,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
c = int(input())
v = int(input())
*s, = map(int,input().split())
*t, = map(int,input().split())
*y, = map(int,input().split())
*m, = map(int,input().split())

g = [[] for _ in range(n)]
for ss,tt,yy,mm in zip(s,t,y,m):
    g[ss-1].append((tt-1,yy,mm))

INF = 10**9
res = [[INF]*(c+1) for _ in range(n)]
res[0][0] = 0
for i in range(n):
    for j in range(c+1):
        if res[i][j] == INF: continue
        for tt,yy,mm in g[i]:
            if j+yy <= c:
                res[tt][j+yy] = min(res[tt][j+yy], res[i][j]+mm)

ans = min(res[-1])
print(ans if ans!=INF else -1)
0