結果

問題 No.1 道のショートカット
ユーザー るさるさ
提出日時 2018-06-03 15:38:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 741 bytes
コンパイル時間 620 ms
コンパイル使用メモリ 11,036 KB
実行使用メモリ 8,932 KB
最終ジャッジ日時 2023-09-22 13:19:20
合計ジャッジ時間 4,343 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,792 KB
testcase_01 AC 16 ms
7,952 KB
testcase_02 AC 16 ms
7,788 KB
testcase_03 AC 16 ms
7,848 KB
testcase_04 AC 15 ms
7,956 KB
testcase_05 AC 16 ms
7,780 KB
testcase_06 AC 15 ms
7,788 KB
testcase_07 AC 16 ms
7,988 KB
testcase_08 WA -
testcase_09 AC 43 ms
8,348 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 17 ms
8,300 KB
testcase_16 WA -
testcase_17 AC 16 ms
7,788 KB
testcase_18 AC 18 ms
8,200 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 22 ms
8,288 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 16 ms
7,828 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 17 ms
7,800 KB
testcase_39 AC 23 ms
8,288 KB
testcase_40 AC 19 ms
8,260 KB
testcase_41 WA -
testcase_42 AC 15 ms
7,792 KB
testcase_43 AC 16 ms
8,348 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]]=table[i][k]+j[2]
                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