結果

問題 No.1 道のショートカット
ユーザー るさるさ
提出日時 2018-06-03 16:14:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 344 ms / 5,000 ms
コード長 803 bytes
コンパイル時間 834 ms
コンパイル使用メモリ 10,944 KB
実行使用メモリ 8,868 KB
最終ジャッジ日時 2023-09-27 22:14:37
合計ジャッジ時間 4,590 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,832 KB
testcase_01 AC 16 ms
7,748 KB
testcase_02 AC 16 ms
7,748 KB
testcase_03 AC 16 ms
8,288 KB
testcase_04 AC 17 ms
7,824 KB
testcase_05 AC 16 ms
7,804 KB
testcase_06 AC 17 ms
8,212 KB
testcase_07 AC 16 ms
8,144 KB
testcase_08 AC 115 ms
8,460 KB
testcase_09 AC 43 ms
8,472 KB
testcase_10 AC 71 ms
8,236 KB
testcase_11 AC 109 ms
8,312 KB
testcase_12 AC 330 ms
8,868 KB
testcase_13 AC 344 ms
8,696 KB
testcase_14 AC 20 ms
8,368 KB
testcase_15 AC 17 ms
8,236 KB
testcase_16 AC 27 ms
8,264 KB
testcase_17 AC 16 ms
7,844 KB
testcase_18 AC 18 ms
8,348 KB
testcase_19 AC 20 ms
8,300 KB
testcase_20 AC 32 ms
8,348 KB
testcase_21 AC 22 ms
8,320 KB
testcase_22 AC 19 ms
8,352 KB
testcase_23 AC 171 ms
8,244 KB
testcase_24 AC 162 ms
8,228 KB
testcase_25 AC 41 ms
8,356 KB
testcase_26 AC 30 ms
8,228 KB
testcase_27 AC 155 ms
8,260 KB
testcase_28 AC 16 ms
7,792 KB
testcase_29 AC 73 ms
8,228 KB
testcase_30 AC 25 ms
8,228 KB
testcase_31 AC 62 ms
8,352 KB
testcase_32 AC 129 ms
8,544 KB
testcase_33 AC 73 ms
8,200 KB
testcase_34 AC 339 ms
8,424 KB
testcase_35 AC 19 ms
8,160 KB
testcase_36 AC 45 ms
8,260 KB
testcase_37 AC 25 ms
8,244 KB
testcase_38 AC 18 ms
8,352 KB
testcase_39 AC 24 ms
8,340 KB
testcase_40 AC 20 ms
8,216 KB
testcase_41 AC 17 ms
8,380 KB
testcase_42 AC 16 ms
8,292 KB
testcase_43 AC 17 ms
8,264 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()))

r=[[] for i in range(n)]
for i in range(v):
    r[s[i]-1].append((t[i]-1,y[i],m[i]))


table=[[-1 for j in range(c+1)] for i in range(n)]
table[0][0]=0
for i in range(n):
    for j in r[i]:
        for k in range(c+1):
            if table[i][k]!=-1:
                try:
                    table[j[0]][k+j[1]]=min([table[i][k]+j[2],(table[j[0]][k+j[1]]==-1)*9999999+table[j[0]][k+j[1]]])
                except:
                    pass

if max(table[n-1])==-1:
    print(-1)
else:
    minm=1000000
    for i in range(c+1):
        if (minm>table[n-1][i])&(table[n-1][i]!=-1):
            minm=table[n-1][i]
    print(minm)
0