結果

問題 No.1 道のショートカット
ユーザー gigurururugigurururu
提出日時 2014-11-04 15:24:24
言語 Python2
(2.7.18)
結果
AC  
実行時間 93 ms / 5,000 ms
コード長 292 bytes
コンパイル時間 1,084 ms
コンパイル使用メモリ 6,500 KB
実行使用メモリ 6,880 KB
最終ジャッジ日時 2023-09-27 21:35:27
合計ジャッジ時間 3,482 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
6,056 KB
testcase_01 AC 10 ms
6,044 KB
testcase_02 AC 10 ms
6,104 KB
testcase_03 AC 11 ms
6,044 KB
testcase_04 AC 9 ms
6,048 KB
testcase_05 AC 11 ms
6,196 KB
testcase_06 AC 10 ms
6,048 KB
testcase_07 AC 10 ms
6,188 KB
testcase_08 AC 20 ms
6,320 KB
testcase_09 AC 13 ms
6,312 KB
testcase_10 AC 17 ms
6,420 KB
testcase_11 AC 38 ms
6,356 KB
testcase_12 AC 58 ms
6,880 KB
testcase_13 AC 53 ms
6,740 KB
testcase_14 AC 10 ms
5,984 KB
testcase_15 AC 9 ms
6,196 KB
testcase_16 AC 11 ms
6,048 KB
testcase_17 AC 11 ms
6,216 KB
testcase_18 AC 10 ms
6,004 KB
testcase_19 AC 11 ms
6,132 KB
testcase_20 AC 15 ms
6,404 KB
testcase_21 AC 11 ms
6,104 KB
testcase_22 AC 10 ms
6,240 KB
testcase_23 AC 93 ms
6,256 KB
testcase_24 AC 90 ms
6,444 KB
testcase_25 AC 23 ms
6,288 KB
testcase_26 AC 16 ms
6,332 KB
testcase_27 AC 72 ms
6,524 KB
testcase_28 AC 10 ms
6,056 KB
testcase_29 AC 24 ms
6,280 KB
testcase_30 AC 12 ms
6,096 KB
testcase_31 AC 21 ms
6,144 KB
testcase_32 AC 25 ms
6,460 KB
testcase_33 AC 17 ms
6,200 KB
testcase_34 AC 67 ms
6,280 KB
testcase_35 AC 13 ms
6,248 KB
testcase_36 AC 16 ms
6,164 KB
testcase_37 AC 14 ms
6,192 KB
testcase_38 AC 11 ms
6,008 KB
testcase_39 AC 10 ms
6,024 KB
testcase_40 AC 11 ms
6,056 KB
testcase_41 AC 11 ms
6,016 KB
testcase_42 AC 10 ms
6,200 KB
testcase_43 AC 10 ms
6,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=input()
c=input()
input()
l=[dict() for _ in range(n+1)]
l[1][0]=0
for s,t,y,m in sorted(zip(*[map(int,raw_input().split()) for _ in range(4)])):
    for k,v in l[s].iteritems():
        if k+y<=c: l[t][k+y]=min(l[t].get(k+y,1e9),v+m)
print min(l[n].values()) if len(l[n])>0 else -1
0