結果

問題 No.1583 Building Blocks
ユーザー tamatotamato
提出日時 2021-07-02 22:24:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 529 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 87,696 KB
実行使用メモリ 76,944 KB
最終ジャッジ日時 2023-09-11 22:34:49
合計ジャッジ時間 5,402 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,532 KB
testcase_01 AC 73 ms
71,720 KB
testcase_02 AC 71 ms
71,720 KB
testcase_03 WA -
testcase_04 AC 74 ms
71,712 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 73 ms
71,732 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 75 ms
75,704 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 79 ms
76,312 KB
testcase_25 AC 71 ms
71,936 KB
testcase_26 AC 80 ms
76,220 KB
testcase_27 AC 77 ms
76,164 KB
testcase_28 AC 82 ms
76,488 KB
testcase_29 AC 75 ms
75,592 KB
testcase_30 AC 72 ms
71,736 KB
testcase_31 AC 81 ms
76,428 KB
testcase_32 AC 77 ms
76,392 KB
testcase_33 AC 81 ms
76,320 KB
testcase_34 AC 70 ms
71,780 KB
testcase_35 AC 82 ms
76,664 KB
testcase_36 AC 80 ms
76,520 KB
testcase_37 AC 72 ms
71,312 KB
testcase_38 AC 70 ms
71,716 KB
testcase_39 AC 70 ms
71,568 KB
testcase_40 AC 71 ms
71,612 KB
testcase_41 AC 72 ms
71,456 KB
testcase_42 AC 72 ms
71,656 KB
testcase_43 AC 70 ms
71,824 KB
testcase_44 AC 71 ms
71,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    from bisect import bisect_left
    input = sys.stdin.readline

    N = int(input())
    WS = []
    for _ in range(N):
        WS.append(tuple(map(int, input().split())))
    WS.sort(key=lambda x: x[0] + x[1])

    LIS = [0]
    for w, s in WS:
        j = bisect_left(LIS, s+1)
        if j == len(LIS):
            LIS.append(LIS[-1] + w)
        else:
            LIS[j] = min(LIS[j], LIS[j-1] + w)
    print(len(LIS) - 1)


if __name__ == '__main__':
    main()
0