結果

問題 No.1 道のショートカット
ユーザー irisAshirisAsh
提出日時 2019-05-19 01:35:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 110 ms / 5,000 ms
コード長 648 bytes
コンパイル時間 111 ms
コンパイル使用メモリ 11,016 KB
実行使用メモリ 8,968 KB
最終ジャッジ日時 2023-09-27 22:19:24
合計ジャッジ時間 3,234 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,164 KB
testcase_01 AC 14 ms
8,316 KB
testcase_02 AC 14 ms
8,184 KB
testcase_03 AC 14 ms
8,188 KB
testcase_04 AC 15 ms
8,300 KB
testcase_05 AC 16 ms
8,288 KB
testcase_06 AC 16 ms
8,280 KB
testcase_07 AC 15 ms
8,272 KB
testcase_08 AC 56 ms
8,540 KB
testcase_09 AC 37 ms
8,660 KB
testcase_10 AC 28 ms
8,548 KB
testcase_11 AC 48 ms
8,404 KB
testcase_12 AC 82 ms
8,968 KB
testcase_13 AC 74 ms
8,916 KB
testcase_14 AC 17 ms
8,224 KB
testcase_15 AC 15 ms
8,296 KB
testcase_16 AC 22 ms
7,988 KB
testcase_17 AC 15 ms
8,304 KB
testcase_18 AC 18 ms
8,032 KB
testcase_19 AC 18 ms
8,316 KB
testcase_20 AC 22 ms
8,020 KB
testcase_21 AC 22 ms
8,276 KB
testcase_22 AC 17 ms
8,340 KB
testcase_23 AC 104 ms
8,428 KB
testcase_24 AC 110 ms
8,520 KB
testcase_25 AC 34 ms
8,008 KB
testcase_26 AC 25 ms
8,240 KB
testcase_27 AC 80 ms
8,476 KB
testcase_28 AC 15 ms
8,288 KB
testcase_29 AC 28 ms
8,408 KB
testcase_30 AC 17 ms
7,984 KB
testcase_31 AC 25 ms
8,180 KB
testcase_32 AC 44 ms
8,628 KB
testcase_33 AC 34 ms
8,368 KB
testcase_34 AC 76 ms
8,372 KB
testcase_35 AC 17 ms
7,996 KB
testcase_36 AC 23 ms
8,428 KB
testcase_37 AC 17 ms
8,180 KB
testcase_38 AC 16 ms
7,984 KB
testcase_39 AC 21 ms
8,380 KB
testcase_40 AC 16 ms
8,056 KB
testcase_41 AC 15 ms
8,300 KB
testcase_42 AC 15 ms
8,124 KB
testcase_43 AC 15 ms
8,256 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()))
z=zip(S,T,Y,M)
d=[[None]*(c+1) for i in range(n)]
d[0][0] = 0
for s,t,y,m in sorted(z,key=lambda x:(x[0],x[1])):
    for j in range(c+1):
        a=d[s-1][j]
        if a is not None:
            q=y+j
            if c<q:
                break
            p=t-1
            x=a+m
            if d[p][q] is None or x<d[p][q]:
                d[p][q]=x
o=None
for x in d[n-1]:
    if x is not None:
        if o is None or x<o:
            o=x
print(-1 if o is None else o)
0