結果
問題 | No.1570 Blocks |
ユーザー |
![]() |
提出日時 | 2025-03-20 18:42:05 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 248 ms / 2,000 ms |
コード長 | 423 bytes |
コンパイル時間 | 190 ms |
コンパイル使用メモリ | 81,908 KB |
実行使用メモリ | 85,696 KB |
最終ジャッジ日時 | 2025-03-20 18:42:20 |
合計ジャッジ時間 | 10,105 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 45 |
ソースコード
n = int(input()) blocks = [] total = 0 for _ in range(n): a, b = map(int, input().split()) blocks.append((a, b)) total += a # Sort by A_i + B_i in descending order blocks.sort(key=lambda x: -(x[0] + x[1])) sum_below = 0 possible = True for a, b in blocks: required = total - (a + b) if sum_below < required: possible = False break sum_below += a print("Yes" if possible else "No")