結果

問題 No.1583 Building Blocks
ユーザー 👑 rin204rin204
提出日時 2022-01-26 23:33:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 106 ms / 2,000 ms
コード長 403 bytes
コンパイル時間 338 ms
コンパイル使用メモリ 87,300 KB
実行使用メモリ 76,936 KB
最終ジャッジ日時 2023-10-12 03:06:23
合計ジャッジ時間 6,186 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
70,980 KB
testcase_01 AC 75 ms
71,296 KB
testcase_02 AC 77 ms
71,252 KB
testcase_03 AC 92 ms
76,372 KB
testcase_04 AC 84 ms
75,924 KB
testcase_05 AC 82 ms
75,992 KB
testcase_06 AC 90 ms
76,336 KB
testcase_07 AC 92 ms
76,468 KB
testcase_08 AC 83 ms
75,852 KB
testcase_09 AC 100 ms
76,608 KB
testcase_10 AC 80 ms
75,840 KB
testcase_11 AC 77 ms
71,360 KB
testcase_12 AC 96 ms
76,460 KB
testcase_13 AC 99 ms
76,936 KB
testcase_14 AC 93 ms
76,440 KB
testcase_15 AC 96 ms
76,476 KB
testcase_16 AC 101 ms
76,900 KB
testcase_17 AC 100 ms
76,492 KB
testcase_18 AC 89 ms
76,196 KB
testcase_19 AC 106 ms
76,824 KB
testcase_20 AC 93 ms
76,416 KB
testcase_21 AC 93 ms
76,076 KB
testcase_22 AC 93 ms
76,688 KB
testcase_23 AC 86 ms
75,920 KB
testcase_24 AC 99 ms
76,736 KB
testcase_25 AC 78 ms
70,984 KB
testcase_26 AC 100 ms
76,532 KB
testcase_27 AC 92 ms
76,752 KB
testcase_28 AC 103 ms
76,600 KB
testcase_29 AC 90 ms
76,412 KB
testcase_30 AC 85 ms
75,948 KB
testcase_31 AC 97 ms
76,524 KB
testcase_32 AC 91 ms
76,580 KB
testcase_33 AC 102 ms
76,604 KB
testcase_34 AC 77 ms
71,360 KB
testcase_35 AC 91 ms
76,504 KB
testcase_36 AC 99 ms
76,856 KB
testcase_37 AC 88 ms
75,928 KB
testcase_38 AC 82 ms
71,104 KB
testcase_39 AC 75 ms
71,300 KB
testcase_40 AC 78 ms
71,264 KB
testcase_41 AC 78 ms
71,236 KB
testcase_42 AC 77 ms
71,140 KB
testcase_43 AC 77 ms
71,168 KB
testcase_44 AC 76 ms
71,360 KB
testcase_45 AC 76 ms
71,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
ws = [list(map(int, input().split())) for _ in range(n)]
ws.sort(key = lambda x:x[0] + x[1])

inf = 1 << 60
dp = [0]
for w, s in ws:
    dp += [inf]
    l = len(dp)
    for i in range(l - 1, 0, -1):
        if dp[i - 1] <= s:
            dp[i] = min(dp[i], dp[i - 1] + w)
            
dp += [inf]
for i in range(1, len(dp)):
    if dp[i] == inf:
        print(i - 1)
        exit()
    
0