結果

問題 No.1583 Building Blocks
ユーザー titiatitia
提出日時 2021-07-02 23:45:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 306 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 8,400 KB
最終ジャッジ日時 2023-10-12 03:04:43
合計ジャッジ時間 4,733 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,828 KB
testcase_01 AC 16 ms
7,832 KB
testcase_02 AC 16 ms
7,828 KB
testcase_03 AC 47 ms
8,212 KB
testcase_04 AC 19 ms
7,816 KB
testcase_05 AC 17 ms
7,832 KB
testcase_06 AC 44 ms
8,212 KB
testcase_07 AC 54 ms
8,264 KB
testcase_08 AC 19 ms
7,784 KB
testcase_09 AC 108 ms
8,320 KB
testcase_10 AC 16 ms
7,836 KB
testcase_11 AC 17 ms
7,836 KB
testcase_12 AC 74 ms
8,192 KB
testcase_13 AC 105 ms
8,324 KB
testcase_14 AC 44 ms
8,268 KB
testcase_15 AC 68 ms
8,384 KB
testcase_16 AC 90 ms
8,284 KB
testcase_17 AC 123 ms
8,320 KB
testcase_18 AC 33 ms
7,812 KB
testcase_19 AC 237 ms
8,252 KB
testcase_20 AC 59 ms
8,312 KB
testcase_21 AC 57 ms
8,264 KB
testcase_22 AC 65 ms
8,400 KB
testcase_23 AC 27 ms
7,832 KB
testcase_24 AC 215 ms
8,296 KB
testcase_25 AC 17 ms
7,972 KB
testcase_26 AC 272 ms
8,320 KB
testcase_27 AC 67 ms
8,212 KB
testcase_28 AC 306 ms
8,380 KB
testcase_29 AC 45 ms
7,828 KB
testcase_30 AC 25 ms
7,936 KB
testcase_31 AC 73 ms
8,268 KB
testcase_32 AC 40 ms
8,264 KB
testcase_33 AC 121 ms
8,320 KB
testcase_34 AC 17 ms
7,824 KB
testcase_35 AC 47 ms
8,196 KB
testcase_36 AC 85 ms
8,256 KB
testcase_37 AC 22 ms
7,888 KB
testcase_38 AC 17 ms
7,756 KB
testcase_39 AC 17 ms
7,772 KB
testcase_40 AC 17 ms
7,828 KB
testcase_41 AC 17 ms
7,780 KB
testcase_42 AC 17 ms
7,892 KB
testcase_43 AC 17 ms
7,828 KB
testcase_44 AC 18 ms
7,828 KB
testcase_45 AC 18 ms
7,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from operator import itemgetter

N=int(input())
W=[tuple(map(int,input().split())) for i in range(N)]

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

DP=[1<<60]*(N+1)
DP[0]=0

for w,s in W:
    for i in range(N,-1,-1):
        if DP[i]==1<<60:
            continue
        if DP[i]<=s:
            DP[i+1]=min(DP[i+1],DP[i]+w)

ANS=0
for i in range(N+1):
    if DP[i]!=1<<60:
        ANS=i
print(ANS)
0