結果

問題 No.951 【本日限定】1枚頼むともう1枚無料!
ユーザー pluto77pluto77
提出日時 2019-12-26 14:31:25
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 818 ms / 2,000 ms
コード長 369 bytes
コンパイル時間 517 ms
コンパイル使用メモリ 76,940 KB
実行使用メモリ 80,640 KB
最終ジャッジ日時 2024-04-14 23:36:48
合計ジャッジ時間 24,696 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
75,524 KB
testcase_01 AC 76 ms
75,380 KB
testcase_02 AC 93 ms
77,444 KB
testcase_03 AC 80 ms
76,736 KB
testcase_04 AC 77 ms
75,252 KB
testcase_05 AC 76 ms
75,656 KB
testcase_06 AC 88 ms
77,344 KB
testcase_07 AC 76 ms
75,512 KB
testcase_08 AC 85 ms
77,216 KB
testcase_09 AC 120 ms
78,376 KB
testcase_10 AC 109 ms
78,396 KB
testcase_11 AC 108 ms
77,740 KB
testcase_12 AC 220 ms
79,392 KB
testcase_13 AC 537 ms
80,396 KB
testcase_14 AC 161 ms
78,360 KB
testcase_15 AC 182 ms
78,520 KB
testcase_16 AC 229 ms
79,960 KB
testcase_17 AC 254 ms
80,060 KB
testcase_18 AC 77 ms
75,444 KB
testcase_19 AC 80 ms
75,540 KB
testcase_20 AC 75 ms
75,540 KB
testcase_21 AC 104 ms
78,584 KB
testcase_22 AC 100 ms
78,624 KB
testcase_23 AC 98 ms
78,968 KB
testcase_24 AC 563 ms
80,296 KB
testcase_25 AC 704 ms
80,264 KB
testcase_26 AC 756 ms
80,388 KB
testcase_27 AC 752 ms
80,540 KB
testcase_28 AC 696 ms
80,284 KB
testcase_29 AC 694 ms
80,532 KB
testcase_30 AC 75 ms
75,400 KB
testcase_31 AC 77 ms
75,668 KB
testcase_32 AC 102 ms
78,232 KB
testcase_33 AC 102 ms
78,500 KB
testcase_34 AC 110 ms
79,032 KB
testcase_35 AC 682 ms
80,292 KB
testcase_36 AC 666 ms
80,144 KB
testcase_37 AC 703 ms
80,428 KB
testcase_38 AC 784 ms
80,432 KB
testcase_39 AC 702 ms
80,036 KB
testcase_40 AC 800 ms
80,640 KB
testcase_41 AC 797 ms
79,920 KB
testcase_42 AC 818 ms
80,292 KB
testcase_43 AC 796 ms
80,316 KB
testcase_44 AC 782 ms
80,188 KB
testcase_45 AC 784 ms
80,168 KB
testcase_46 AC 715 ms
80,520 KB
testcase_47 AC 708 ms
80,260 KB
testcase_48 AC 705 ms
80,288 KB
testcase_49 AC 696 ms
80,148 KB
testcase_50 AC 699 ms
80,148 KB
testcase_51 AC 705 ms
80,312 KB
testcase_52 AC 410 ms
80,408 KB
testcase_53 AC 475 ms
80,164 KB
testcase_54 AC 549 ms
79,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki951

n,k=map(int,raw_input().split())
pd=[]
for i in range(n):
 p,d=map(int,raw_input().split())
 pd.append([p,d])
pd.sort(key=lambda x:x[0],reverse=True)
dp=[[-(1<<26)] *2 for i in range(k+1)]
dp[0][0]=0
for p,d in pd:
 for i in range(k,-1,-1):
  dp[i][0]=max(dp[i][0],dp[i][1]+d)
  if i>=p:
   dp[i][1]=max(dp[i][1],dp[i-p][0]+d)
print max([max(i) for i in dp])
0