結果

問題 No.2093 Shio Ramen
ユーザー ThetaTheta
提出日時 2022-10-11 16:38:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 605 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 8,436 KB
最終ジャッジ日時 2023-09-07 18:03:21
合計ジャッジ時間 2,492 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,960 KB
testcase_01 AC 16 ms
7,956 KB
testcase_02 AC 15 ms
7,840 KB
testcase_03 AC 15 ms
7,844 KB
testcase_04 AC 15 ms
8,012 KB
testcase_05 AC 16 ms
7,960 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 16 ms
7,916 KB
testcase_09 WA -
testcase_10 AC 18 ms
8,244 KB
testcase_11 WA -
testcase_12 AC 17 ms
7,860 KB
testcase_13 AC 17 ms
7,972 KB
testcase_14 WA -
testcase_15 AC 17 ms
8,312 KB
testcase_16 WA -
testcase_17 AC 18 ms
8,244 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

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