結果

問題 No.1583 Building Blocks
ユーザー shino16shino16
提出日時 2021-04-04 17:30:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 349 bytes
コンパイル時間 1,057 ms
コンパイル使用メモリ 87,168 KB
実行使用メモリ 76,744 KB
最終ジャッジ日時 2023-10-12 03:02:00
合計ジャッジ時間 6,477 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,508 KB
testcase_01 AC 77 ms
71,272 KB
testcase_02 AC 77 ms
71,452 KB
testcase_03 AC 92 ms
76,340 KB
testcase_04 AC 84 ms
75,764 KB
testcase_05 AC 81 ms
75,748 KB
testcase_06 AC 89 ms
76,352 KB
testcase_07 AC 91 ms
76,344 KB
testcase_08 AC 82 ms
75,784 KB
testcase_09 AC 99 ms
76,488 KB
testcase_10 AC 81 ms
75,700 KB
testcase_11 AC 76 ms
71,116 KB
testcase_12 AC 94 ms
76,296 KB
testcase_13 AC 97 ms
76,532 KB
testcase_14 AC 90 ms
76,200 KB
testcase_15 AC 96 ms
76,200 KB
testcase_16 AC 98 ms
76,440 KB
testcase_17 AC 97 ms
76,356 KB
testcase_18 AC 87 ms
75,960 KB
testcase_19 AC 105 ms
76,696 KB
testcase_20 AC 91 ms
76,148 KB
testcase_21 AC 92 ms
76,148 KB
testcase_22 AC 90 ms
76,404 KB
testcase_23 AC 86 ms
75,656 KB
testcase_24 AC 99 ms
76,444 KB
testcase_25 AC 76 ms
71,252 KB
testcase_26 AC 102 ms
76,512 KB
testcase_27 AC 89 ms
76,240 KB
testcase_28 AC 103 ms
76,744 KB
testcase_29 AC 88 ms
76,196 KB
testcase_30 AC 86 ms
75,956 KB
testcase_31 AC 97 ms
76,568 KB
testcase_32 AC 90 ms
76,204 KB
testcase_33 AC 102 ms
76,636 KB
testcase_34 AC 77 ms
71,224 KB
testcase_35 AC 91 ms
76,076 KB
testcase_36 AC 97 ms
76,588 KB
testcase_37 AC 87 ms
76,304 KB
testcase_38 AC 77 ms
71,272 KB
testcase_39 AC 75 ms
71,208 KB
testcase_40 AC 75 ms
71,304 KB
testcase_41 AC 73 ms
71,268 KB
testcase_42 AC 73 ms
71,200 KB
testcase_43 AC 75 ms
71,544 KB
testcase_44 AC 74 ms
71,228 KB
testcase_45 AC 74 ms
71,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
ws = [list(map(int, input().split())) for _ in range(n)]

ws.sort(key=lambda x: x[0] + x[1])

dp = [1 << 60] * (n + 1)
dp[0] = 0

for w, s in ws:
    for i in range(n, 0, -1):
        if dp[i - 1] <= s:
            dp[i] = min(dp[i], dp[i - 1] + w)

for i in range(n, 0, -1):
    if dp[i] != 1 << 60:
        print(i)
        break
0