結果

問題 No.951 【本日限定】1枚頼むともう1枚無料!
ユーザー titiatitia
提出日時 2020-01-04 20:26:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 438 ms / 2,000 ms
コード長 375 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 77,432 KB
最終ジャッジ日時 2024-05-02 08:47:33
合計ジャッジ時間 11,436 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
51,712 KB
testcase_01 AC 33 ms
52,096 KB
testcase_02 AC 44 ms
61,184 KB
testcase_03 AC 38 ms
58,496 KB
testcase_04 AC 42 ms
52,096 KB
testcase_05 AC 33 ms
52,096 KB
testcase_06 AC 42 ms
61,056 KB
testcase_07 AC 34 ms
52,224 KB
testcase_08 AC 45 ms
59,520 KB
testcase_09 AC 68 ms
67,968 KB
testcase_10 AC 62 ms
66,944 KB
testcase_11 AC 61 ms
67,268 KB
testcase_12 AC 131 ms
76,800 KB
testcase_13 AC 322 ms
76,928 KB
testcase_14 AC 94 ms
72,448 KB
testcase_15 AC 92 ms
71,488 KB
testcase_16 AC 116 ms
76,544 KB
testcase_17 AC 124 ms
77,184 KB
testcase_18 AC 37 ms
52,096 KB
testcase_19 AC 36 ms
52,096 KB
testcase_20 AC 35 ms
52,096 KB
testcase_21 AC 57 ms
65,024 KB
testcase_22 AC 55 ms
64,640 KB
testcase_23 AC 56 ms
64,896 KB
testcase_24 AC 308 ms
76,928 KB
testcase_25 AC 328 ms
77,056 KB
testcase_26 AC 337 ms
77,056 KB
testcase_27 AC 353 ms
77,040 KB
testcase_28 AC 249 ms
77,056 KB
testcase_29 AC 259 ms
77,184 KB
testcase_30 AC 37 ms
52,352 KB
testcase_31 AC 35 ms
52,096 KB
testcase_32 AC 52 ms
64,512 KB
testcase_33 AC 55 ms
65,664 KB
testcase_34 AC 57 ms
66,176 KB
testcase_35 AC 438 ms
76,928 KB
testcase_36 AC 359 ms
77,432 KB
testcase_37 AC 358 ms
77,244 KB
testcase_38 AC 351 ms
76,928 KB
testcase_39 AC 363 ms
77,220 KB
testcase_40 AC 365 ms
77,056 KB
testcase_41 AC 376 ms
77,404 KB
testcase_42 AC 386 ms
77,056 KB
testcase_43 AC 363 ms
76,928 KB
testcase_44 AC 351 ms
77,056 KB
testcase_45 AC 362 ms
77,184 KB
testcase_46 AC 250 ms
77,056 KB
testcase_47 AC 244 ms
76,928 KB
testcase_48 AC 250 ms
76,928 KB
testcase_49 AC 241 ms
77,056 KB
testcase_50 AC 245 ms
76,928 KB
testcase_51 AC 248 ms
77,132 KB
testcase_52 AC 278 ms
77,036 KB
testcase_53 AC 295 ms
76,928 KB
testcase_54 AC 148 ms
76,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
P=[tuple(map(int,input().split())) for i in range(N)]

P.sort(reverse=True)

BUY=[0]*(K+1)
SERVICE=[0]*(K+1)

for p,d in P:
    for i in range(K,-1,-1):
        if BUY[i]!=0:
            SERVICE[i]=max(SERVICE[i],BUY[i]+d)
        if i>=p:
            BUY[i]=max(BUY[i],SERVICE[i-p]+d)

    #print(BUY,SERVICE)

print(max(max(BUY),max(SERVICE)))
0