結果

問題 No.1 道のショートカット
ユーザー szkhtsszkhts
提出日時 2020-06-05 11:06:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 109 ms / 5,000 ms
コード長 745 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 10,964 KB
実行使用メモリ 8,996 KB
最終ジャッジ日時 2023-09-27 22:29:47
合計ジャッジ時間 2,875 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
8,340 KB
testcase_01 AC 14 ms
8,008 KB
testcase_02 AC 14 ms
8,300 KB
testcase_03 AC 14 ms
8,312 KB
testcase_04 AC 15 ms
8,300 KB
testcase_05 AC 16 ms
8,192 KB
testcase_06 AC 15 ms
8,212 KB
testcase_07 AC 15 ms
7,916 KB
testcase_08 AC 52 ms
8,544 KB
testcase_09 AC 36 ms
8,584 KB
testcase_10 AC 27 ms
8,548 KB
testcase_11 AC 47 ms
8,400 KB
testcase_12 AC 77 ms
8,996 KB
testcase_13 AC 76 ms
8,900 KB
testcase_14 AC 18 ms
8,084 KB
testcase_15 AC 15 ms
8,272 KB
testcase_16 AC 22 ms
8,008 KB
testcase_17 AC 16 ms
8,304 KB
testcase_18 AC 17 ms
8,148 KB
testcase_19 AC 18 ms
8,036 KB
testcase_20 AC 21 ms
8,288 KB
testcase_21 AC 21 ms
8,368 KB
testcase_22 AC 18 ms
8,300 KB
testcase_23 AC 105 ms
8,400 KB
testcase_24 AC 109 ms
8,628 KB
testcase_25 AC 34 ms
8,328 KB
testcase_26 AC 25 ms
8,300 KB
testcase_27 AC 85 ms
8,560 KB
testcase_28 AC 15 ms
8,208 KB
testcase_29 AC 27 ms
8,472 KB
testcase_30 AC 18 ms
8,020 KB
testcase_31 AC 25 ms
8,000 KB
testcase_32 AC 45 ms
8,508 KB
testcase_33 AC 35 ms
8,444 KB
testcase_34 AC 73 ms
8,476 KB
testcase_35 AC 18 ms
8,292 KB
testcase_36 AC 24 ms
8,452 KB
testcase_37 AC 16 ms
8,096 KB
testcase_38 AC 15 ms
8,368 KB
testcase_39 AC 20 ms
8,416 KB
testcase_40 AC 15 ms
8,052 KB
testcase_41 AC 14 ms
8,256 KB
testcase_42 AC 14 ms
7,896 KB
testcase_43 AC 13 ms
8,212 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)

dp = [[None] * (C + 1) for i in range(N)]
dp[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 = dp[s - 1][j]
        if a is not None:
            q = y + j
            if C < q:
                break
            p = t - 1
            x = a + m
            if dp[p][q] is None or x < dp[p][q]:
                dp[p][q] = x

o = None
for x in dp[N - 1]:
    if x is not None:
        if o is None or x < o:
            o = x

if o is None:
    print(-1)
else:
    print(o)
0