結果

問題 No.1583 Building Blocks
ユーザー KudeKude
提出日時 2021-07-03 00:00:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 106 ms / 2,000 ms
コード長 322 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 76,864 KB
最終ジャッジ日時 2023-10-12 03:04:46
合計ジャッジ時間 6,153 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,248 KB
testcase_01 AC 75 ms
71,360 KB
testcase_02 AC 78 ms
71,412 KB
testcase_03 AC 92 ms
76,308 KB
testcase_04 AC 81 ms
75,720 KB
testcase_05 AC 76 ms
71,232 KB
testcase_06 AC 89 ms
76,392 KB
testcase_07 AC 91 ms
76,444 KB
testcase_08 AC 78 ms
75,660 KB
testcase_09 AC 99 ms
76,760 KB
testcase_10 AC 75 ms
71,244 KB
testcase_11 AC 74 ms
71,300 KB
testcase_12 AC 94 ms
76,636 KB
testcase_13 AC 98 ms
76,324 KB
testcase_14 AC 89 ms
76,372 KB
testcase_15 AC 95 ms
76,772 KB
testcase_16 AC 98 ms
76,280 KB
testcase_17 AC 97 ms
76,604 KB
testcase_18 AC 84 ms
76,012 KB
testcase_19 AC 106 ms
76,632 KB
testcase_20 AC 92 ms
76,708 KB
testcase_21 AC 92 ms
76,416 KB
testcase_22 AC 91 ms
76,600 KB
testcase_23 AC 85 ms
76,128 KB
testcase_24 AC 98 ms
76,376 KB
testcase_25 AC 75 ms
71,384 KB
testcase_26 AC 100 ms
76,552 KB
testcase_27 AC 92 ms
76,616 KB
testcase_28 AC 102 ms
76,864 KB
testcase_29 AC 87 ms
76,448 KB
testcase_30 AC 83 ms
75,864 KB
testcase_31 AC 95 ms
76,500 KB
testcase_32 AC 91 ms
76,544 KB
testcase_33 AC 103 ms
76,488 KB
testcase_34 AC 77 ms
71,304 KB
testcase_35 AC 93 ms
76,304 KB
testcase_36 AC 96 ms
76,512 KB
testcase_37 AC 84 ms
75,940 KB
testcase_38 AC 81 ms
71,404 KB
testcase_39 AC 73 ms
71,356 KB
testcase_40 AC 76 ms
71,504 KB
testcase_41 AC 77 ms
71,244 KB
testcase_42 AC 76 ms
71,396 KB
testcase_43 AC 75 ms
71,284 KB
testcase_44 AC 75 ms
71,328 KB
testcase_45 AC 75 ms
71,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
ws = sorted((tuple(map(int, input().split())) for _ in range(n)), key=lambda p: sum(p))
dp = [0]
for w, s in ws:
    sz = len(dp)
    if dp[-1] <= s:
        dp.append(dp[-1] + w)
    for i in range(sz - 1)[::-1]:
        if dp[i] <= s:
            dp[i + 1] = min(dp[i + 1], dp[i] + w)
print(len(dp) - 1)
0