結果

問題 No.158 奇妙なお使い
ユーザー maspymaspy
提出日時 2020-03-18 12:16:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 782 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 10,916 KB
実行使用メモリ 9,176 KB
最終ジャッジ日時 2023-08-20 19:48:41
合計ジャッジ時間 8,882 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
8,732 KB
testcase_01 AC 1,112 ms
8,756 KB
testcase_02 AC 40 ms
8,732 KB
testcase_03 AC 20 ms
8,760 KB
testcase_04 RE -
testcase_05 AC 20 ms
8,588 KB
testcase_06 AC 19 ms
8,620 KB
testcase_07 AC 20 ms
8,632 KB
testcase_08 AC 20 ms
8,696 KB
testcase_09 AC 19 ms
8,728 KB
testcase_10 AC 34 ms
8,792 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3.8
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from functools import lru_cache

# %%
A = tuple(map(int, readline().split()))
DB = int(readline())
B = tuple(map(int, readline().split()))
DC = int(readline())
C = tuple(map(int, readline().split()))


# %%
def f(X, Y, Z):
    ret = 0
    for cost, gain in ((DB, B), (DC, C)):
        x = cost // 1000
        if X < x:
            x = X
        cost -= 1000 * x
        y = cost // 100
        if Y < y:
            y = Y
        cost -= 100 * y
        if cost > Z:
            continue
        n = 1 + f(X - x + gain[0], Y - y + gain[1], Z - cost + gain[2])
        if ret < n:
            ret = n
    return ret


# %%
print(f(*A))
0