結果

問題 No.1 道のショートカット
ユーザー zarath8128zarath8128
提出日時 2018-03-11 13:46:02
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 30 ms / 5,000 ms
コード長 652 bytes
コンパイル時間 120 ms
コンパイル使用メモリ 10,856 KB
実行使用メモリ 8,616 KB
最終ジャッジ日時 2023-09-27 22:13:01
合計ジャッジ時間 2,576 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,984 KB
testcase_01 AC 17 ms
7,996 KB
testcase_02 AC 17 ms
8,144 KB
testcase_03 AC 17 ms
8,144 KB
testcase_04 AC 16 ms
8,004 KB
testcase_05 AC 16 ms
8,180 KB
testcase_06 AC 16 ms
8,032 KB
testcase_07 AC 16 ms
8,156 KB
testcase_08 AC 19 ms
8,032 KB
testcase_09 AC 18 ms
8,172 KB
testcase_10 AC 20 ms
8,368 KB
testcase_11 AC 22 ms
8,424 KB
testcase_12 AC 23 ms
8,516 KB
testcase_13 AC 22 ms
8,616 KB
testcase_14 AC 17 ms
8,216 KB
testcase_15 AC 17 ms
7,848 KB
testcase_16 AC 17 ms
8,064 KB
testcase_17 AC 16 ms
8,028 KB
testcase_18 AC 17 ms
8,308 KB
testcase_19 AC 16 ms
8,240 KB
testcase_20 AC 17 ms
8,024 KB
testcase_21 AC 16 ms
8,400 KB
testcase_22 AC 16 ms
8,284 KB
testcase_23 AC 30 ms
8,560 KB
testcase_24 AC 27 ms
7,948 KB
testcase_25 AC 18 ms
7,952 KB
testcase_26 AC 18 ms
8,288 KB
testcase_27 AC 26 ms
8,420 KB
testcase_28 AC 16 ms
8,008 KB
testcase_29 AC 25 ms
8,560 KB
testcase_30 AC 18 ms
7,952 KB
testcase_31 AC 23 ms
8,008 KB
testcase_32 AC 20 ms
8,132 KB
testcase_33 AC 19 ms
8,032 KB
testcase_34 AC 25 ms
8,508 KB
testcase_35 AC 23 ms
7,956 KB
testcase_36 AC 20 ms
8,184 KB
testcase_37 AC 20 ms
8,020 KB
testcase_38 AC 16 ms
8,200 KB
testcase_39 AC 16 ms
8,236 KB
testcase_40 AC 17 ms
8,032 KB
testcase_41 AC 17 ms
8,360 KB
testcase_42 AC 17 ms
7,948 KB
testcase_43 AC 17 ms
7,976 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()))

G = sorted([(S[i], T[i], Y[i], M[i]) for i in range(0, V)])

L = [set() for i in range(1, N + 1)]
L[0].add((0, 0))

for (s, t, y, m) in G:
    for (y2, m2) in L[s - 1]:
        if y2 + y <= C:
            for (y3, m3) in L[t - 1]:
                if y3 < y2 + y and m3 < m2 + m:
                    break
            else:
                L[t - 1].add((y + y2, m + m2))

if L[N - 1] == set():
    print(-1)
else:
    print(min([t for (c, t) in L[N - 1]]))
0