結果

問題 No.1583 Building Blocks
ユーザー rlangevinrlangevin
提出日時 2023-10-16 12:27:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 426 bytes
コンパイル時間 463 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 76,628 KB
最終ジャッジ日時 2023-10-16 12:27:07
合計ジャッジ時間 7,242 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,248 KB
testcase_01 AC 76 ms
71,220 KB
testcase_02 AC 75 ms
71,320 KB
testcase_03 AC 88 ms
76,576 KB
testcase_04 AC 81 ms
76,128 KB
testcase_05 AC 81 ms
76,048 KB
testcase_06 AC 83 ms
76,480 KB
testcase_07 AC 93 ms
76,520 KB
testcase_08 AC 82 ms
76,236 KB
testcase_09 AC 89 ms
76,628 KB
testcase_10 AC 81 ms
76,000 KB
testcase_11 AC 76 ms
71,288 KB
testcase_12 AC 87 ms
76,376 KB
testcase_13 AC 91 ms
76,592 KB
testcase_14 AC 86 ms
76,156 KB
testcase_15 AC 89 ms
76,532 KB
testcase_16 AC 92 ms
76,500 KB
testcase_17 WA -
testcase_18 AC 88 ms
76,240 KB
testcase_19 AC 94 ms
76,512 KB
testcase_20 AC 87 ms
76,500 KB
testcase_21 AC 88 ms
76,496 KB
testcase_22 AC 86 ms
76,452 KB
testcase_23 AC 82 ms
76,012 KB
testcase_24 AC 92 ms
76,148 KB
testcase_25 AC 76 ms
71,088 KB
testcase_26 AC 95 ms
76,368 KB
testcase_27 AC 86 ms
76,508 KB
testcase_28 AC 99 ms
76,504 KB
testcase_29 AC 85 ms
76,352 KB
testcase_30 AC 83 ms
76,124 KB
testcase_31 AC 86 ms
76,232 KB
testcase_32 AC 84 ms
76,576 KB
testcase_33 AC 90 ms
76,332 KB
testcase_34 AC 75 ms
71,600 KB
testcase_35 AC 84 ms
76,388 KB
testcase_36 AC 89 ms
76,336 KB
testcase_37 AC 81 ms
76,116 KB
testcase_38 AC 76 ms
71,384 KB
testcase_39 AC 77 ms
71,244 KB
testcase_40 AC 77 ms
71,228 KB
testcase_41 AC 75 ms
71,232 KB
testcase_42 AC 76 ms
71,236 KB
testcase_43 AC 74 ms
71,348 KB
testcase_44 AC 78 ms
71,236 KB
testcase_45 AC 78 ms
71,400 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*(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