結果

問題 No.1583 Building Blocks
ユーザー 👑 KazunKazun
提出日時 2021-07-02 22:53:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 106 ms / 2,000 ms
コード長 319 bytes
コンパイル時間 305 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 76,752 KB
最終ジャッジ日時 2023-10-12 03:04:09
合計ジャッジ時間 6,001 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,336 KB
testcase_01 AC 74 ms
71,208 KB
testcase_02 AC 73 ms
71,228 KB
testcase_03 AC 93 ms
76,516 KB
testcase_04 AC 83 ms
76,008 KB
testcase_05 AC 82 ms
76,080 KB
testcase_06 AC 90 ms
76,552 KB
testcase_07 AC 91 ms
76,516 KB
testcase_08 AC 81 ms
76,108 KB
testcase_09 AC 105 ms
76,356 KB
testcase_10 AC 80 ms
76,092 KB
testcase_11 AC 75 ms
71,172 KB
testcase_12 AC 97 ms
76,220 KB
testcase_13 AC 99 ms
76,500 KB
testcase_14 AC 90 ms
76,520 KB
testcase_15 AC 95 ms
76,592 KB
testcase_16 AC 100 ms
76,496 KB
testcase_17 AC 104 ms
76,520 KB
testcase_18 AC 85 ms
76,100 KB
testcase_19 AC 106 ms
76,684 KB
testcase_20 AC 89 ms
76,364 KB
testcase_21 AC 88 ms
76,220 KB
testcase_22 AC 90 ms
76,532 KB
testcase_23 AC 85 ms
76,132 KB
testcase_24 AC 100 ms
76,496 KB
testcase_25 AC 74 ms
71,300 KB
testcase_26 AC 102 ms
76,700 KB
testcase_27 AC 90 ms
76,600 KB
testcase_28 AC 104 ms
76,752 KB
testcase_29 AC 90 ms
76,408 KB
testcase_30 AC 84 ms
76,192 KB
testcase_31 AC 96 ms
76,556 KB
testcase_32 AC 88 ms
76,396 KB
testcase_33 AC 102 ms
76,644 KB
testcase_34 AC 75 ms
71,336 KB
testcase_35 AC 90 ms
76,276 KB
testcase_36 AC 97 ms
76,460 KB
testcase_37 AC 84 ms
76,540 KB
testcase_38 AC 73 ms
71,324 KB
testcase_39 AC 74 ms
71,524 KB
testcase_40 AC 75 ms
71,332 KB
testcase_41 AC 74 ms
71,112 KB
testcase_42 AC 74 ms
71,416 KB
testcase_43 AC 74 ms
71,148 KB
testcase_44 AC 77 ms
71,300 KB
testcase_45 AC 76 ms
71,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
F=[]
for _ in range(N):
    w,s=map(int,input().split())
    F.append((w,s))

F.sort(key=lambda x:sum(x))

inf=float("inf")
DP=[inf]*(N+1)
DP[0]=0

for (w,s) in F:
    for k in range(N,0,-1):
        if DP[k-1]<=s:
            DP[k]=min(DP[k],DP[k-1]+w)

print(max([k for k in range(N+1) if DP[k]<inf]))
0