結果

問題 No.1570 Blocks
ユーザー tamato
提出日時 2021-08-06 08:27:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 178 ms / 2,000 ms
コード長 459 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 82,340 KB
実行使用メモリ 83,520 KB
最終ジャッジ日時 2024-09-16 21:06:14
合計ジャッジ時間 9,070 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 45
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


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

    N = int(input())
    C = []
    for _ in range(N):
        a, b = map(int, input().split())
        C.append((a, a + b))
    C.sort(key=lambda x: x[1])
    W = 0
    ok = 1
    for a, b in C:
        W += a
        if W > b:
            ok = 0
            break
    if ok:
        print("Yes")
    else:
        print("No")


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