結果

問題 No.1583 Building Blocks
ユーザー ygd.
提出日時 2021-07-02 23:15:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 360 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 62,080 KB
最終ジャッジ日時 2024-06-29 13:03:31
合計ジャッジ時間 3,536 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N = int(input())
    Z = []
    for i in range(N):
        w,s = map(int,input().split())
        Z.append((w,s))
    Z.sort(key = lambda x: x[0] + x[1])
    ans = 0
    weight = 0
    for i in range(N):
        w,s = Z[i]
        if weight <= s:
            ans += 1
            weight += w
    print(ans)
if __name__ == '__main__':
    main()
0