結果
問題 | No.1583 Building Blocks |
ユーザー |
![]() |
提出日時 | 2021-07-02 22:24:41 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 529 bytes |
コンパイル時間 | 268 ms |
コンパイル使用メモリ | 82,528 KB |
実行使用メモリ | 63,792 KB |
最終ジャッジ日時 | 2024-06-29 12:09:53 |
合計ジャッジ時間 | 3,471 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 WA * 18 |
ソースコード
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()