結果

問題 No.1 道のショートカット
ユーザー roiti46roiti46
提出日時 2015-02-16 00:37:46
言語 Python2
(2.7.18)
結果
AC  
実行時間 114 ms / 5,000 ms
コード長 492 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 6,684 KB
実行使用メモリ 6,784 KB
最終ジャッジ日時 2023-09-27 21:38:53
合計ジャッジ時間 3,427 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,120 KB
testcase_01 AC 10 ms
6,020 KB
testcase_02 AC 10 ms
5,892 KB
testcase_03 AC 10 ms
6,000 KB
testcase_04 AC 11 ms
6,032 KB
testcase_05 AC 10 ms
6,116 KB
testcase_06 AC 11 ms
5,956 KB
testcase_07 AC 10 ms
5,956 KB
testcase_08 AC 85 ms
6,460 KB
testcase_09 AC 49 ms
6,312 KB
testcase_10 AC 33 ms
6,208 KB
testcase_11 AC 51 ms
6,316 KB
testcase_12 AC 114 ms
6,784 KB
testcase_13 AC 108 ms
6,784 KB
testcase_14 AC 15 ms
5,948 KB
testcase_15 AC 10 ms
6,228 KB
testcase_16 AC 25 ms
6,092 KB
testcase_17 AC 11 ms
5,980 KB
testcase_18 AC 16 ms
6,172 KB
testcase_19 AC 22 ms
6,212 KB
testcase_20 AC 25 ms
6,176 KB
testcase_21 AC 30 ms
6,168 KB
testcase_22 AC 19 ms
6,212 KB
testcase_23 AC 94 ms
6,316 KB
testcase_24 AC 107 ms
6,080 KB
testcase_25 AC 41 ms
6,252 KB
testcase_26 AC 30 ms
6,000 KB
testcase_27 AC 81 ms
6,344 KB
testcase_28 AC 12 ms
6,044 KB
testcase_29 AC 24 ms
6,204 KB
testcase_30 AC 14 ms
6,088 KB
testcase_31 AC 21 ms
6,152 KB
testcase_32 AC 66 ms
6,292 KB
testcase_33 AC 48 ms
6,340 KB
testcase_34 AC 76 ms
6,384 KB
testcase_35 AC 14 ms
6,276 KB
testcase_36 AC 25 ms
6,276 KB
testcase_37 AC 15 ms
6,252 KB
testcase_38 AC 13 ms
6,088 KB
testcase_39 AC 21 ms
6,160 KB
testcase_40 AC 14 ms
6,276 KB
testcase_41 AC 12 ms
6,172 KB
testcase_42 AC 10 ms
6,024 KB
testcase_43 AC 11 ms
6,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

inf = 10**9

N,C,V = [int(raw_input()) for i in range(3)]
S,T,Y,M = [map(int,raw_input().split()) for i in range(4)]
G = [[[] for i in xrange(N)] for j in xrange(N)]
for s,t,y,m in zip(S,T,Y,M): G[s-1][t-1].append([y,m])

dp = [[inf]*(C+1) for i in xrange(N)]
dp[0][C] = 0
for i in xrange(N):
    for j in xrange(i+1,N):
        for y,m in G[i][j]:
            for c in xrange(y,C+1):
                dp[j][c-y] = min(dp[j][c-y], dp[i][c]+m)
ans = min(dp[N-1])
print ans if ans < inf else -1
0