結果

問題 No.2093 Shio Ramen
ユーザー Theta
提出日時 2022-10-11 16:38:10
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 605 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-06-25 11:50:55
合計ジャッジ時間 2,440 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N, I = map(int, input().split())
    salt_taste_list = []
    for _ in range(N):
        salt_taste_list.append(tuple(map(int, input().split())))

    salt_taste_list.sort(key=lambda ramen: ramen[1]/ramen[0], reverse=True)
    current_taste = 0
    current_salt = 0
    for ramen in salt_taste_list:
        if current_salt > I:
            raise ValueError
        if current_salt == I:
            break

        if current_salt + ramen[0] <= I:
            current_taste += ramen[1]
            current_salt += ramen[0]

    print(current_taste)


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