結果

問題 No.1583 Building Blocks
ユーザー rlangevinrlangevin
提出日時 2023-10-16 12:35:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 422 bytes
コンパイル時間 2,503 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 76,612 KB
最終ジャッジ日時 2023-10-16 12:35:49
合計ジャッジ時間 8,501 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,220 KB
testcase_01 AC 69 ms
71,372 KB
testcase_02 AC 69 ms
71,512 KB
testcase_03 AC 114 ms
76,200 KB
testcase_04 AC 75 ms
76,100 KB
testcase_05 AC 74 ms
75,824 KB
testcase_06 AC 78 ms
76,564 KB
testcase_07 AC 79 ms
76,260 KB
testcase_08 AC 74 ms
76,136 KB
testcase_09 AC 84 ms
76,148 KB
testcase_10 AC 71 ms
75,812 KB
testcase_11 AC 68 ms
71,316 KB
testcase_12 AC 83 ms
76,572 KB
testcase_13 AC 84 ms
76,280 KB
testcase_14 AC 80 ms
76,280 KB
testcase_15 AC 96 ms
76,368 KB
testcase_16 AC 84 ms
76,368 KB
testcase_17 AC 83 ms
76,496 KB
testcase_18 AC 79 ms
76,116 KB
testcase_19 AC 89 ms
76,152 KB
testcase_20 AC 80 ms
76,560 KB
testcase_21 AC 81 ms
76,152 KB
testcase_22 AC 81 ms
76,548 KB
testcase_23 AC 76 ms
76,116 KB
testcase_24 AC 86 ms
76,600 KB
testcase_25 AC 69 ms
71,348 KB
testcase_26 AC 114 ms
76,596 KB
testcase_27 AC 80 ms
76,264 KB
testcase_28 AC 90 ms
76,368 KB
testcase_29 AC 78 ms
76,448 KB
testcase_30 AC 77 ms
76,164 KB
testcase_31 AC 80 ms
76,612 KB
testcase_32 AC 77 ms
76,576 KB
testcase_33 AC 83 ms
76,484 KB
testcase_34 AC 67 ms
71,520 KB
testcase_35 AC 79 ms
76,468 KB
testcase_36 AC 81 ms
76,512 KB
testcase_37 AC 75 ms
76,464 KB
testcase_38 AC 71 ms
71,392 KB
testcase_39 AC 68 ms
71,084 KB
testcase_40 AC 68 ms
71,224 KB
testcase_41 AC 70 ms
71,600 KB
testcase_42 AC 69 ms
71,308 KB
testcase_43 AC 69 ms
71,240 KB
testcase_44 AC 70 ms
71,348 KB
testcase_45 AC 69 ms
71,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N = int(input())
D = []
for i in range(N):
    w, s = map(int, input().split())
    D.append((s + w, w, s))

D.sort()
inf = 10 ** 18
dp = [inf] * (N + 1)
dp[0] = 0
for i in range(N):
    for j in range(N -1, -1, -1):
        if D[i][2] >= dp[j]:
            dp[j + 1] = min(dp[j + 1], dp[j] + D[i][1])

ans = -1
for i in range(N + 1):
    if dp[i] != inf:
        ans = i

print(ans)
0