結果

問題 No.2093 Shio Ramen
コンテスト
ユーザー Theta
提出日時 2022-10-11 16:38:10
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 605 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 487 ms
コンパイル使用メモリ 20,828 KB
実行使用メモリ 15,616 KB
最終ジャッジ日時 2026-03-11 20:16:22
合計ジャッジ時間 4,896 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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