結果

問題 No.158 奇妙なお使い
ユーザー chocoruskchocorusk
提出日時 2020-09-13 22:20:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 902 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,736 KB
実行使用メモリ 9,536 KB
最終ジャッジ日時 2023-09-03 23:59:27
合計ジャッジ時間 2,461 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,220 KB
testcase_01 AC 19 ms
8,480 KB
testcase_02 AC 17 ms
8,308 KB
testcase_03 AC 17 ms
8,304 KB
testcase_04 RE -
testcase_05 AC 16 ms
7,812 KB
testcase_06 AC 16 ms
8,224 KB
testcase_07 AC 16 ms
8,224 KB
testcase_08 AC 16 ms
8,212 KB
testcase_09 AC 17 ms
8,184 KB
testcase_10 AC 18 ms
8,484 KB
testcase_11 AC 18 ms
8,424 KB
testcase_12 AC 17 ms
8,192 KB
testcase_13 AC 17 ms
8,356 KB
testcase_14 AC 19 ms
8,408 KB
testcase_15 AC 24 ms
8,480 KB
testcase_16 AC 17 ms
8,360 KB
testcase_17 AC 41 ms
9,536 KB
testcase_18 RE -
testcase_19 AC 16 ms
8,380 KB
testcase_20 AC 19 ms
8,528 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 17 ms
8,184 KB
testcase_24 AC 16 ms
8,236 KB
testcase_25 AC 16 ms
8,296 KB
testcase_26 AC 18 ms
8,384 KB
testcase_27 AC 16 ms
8,292 KB
testcase_28 AC 21 ms
8,484 KB
testcase_29 AC 17 ms
8,272 KB
testcase_30 AC 32 ms
9,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read=sys.stdin.buffer.read
readline=sys.stdin.buffer.readline
readlines=sys.stdin.buffer.readlines
a1000, a100, a1=map(int, readline().split())
db=int(readline())
b1000, b100, b1=map(int, readline().split())
dc=int(readline())
c1000, c100, c1=map(int, readline().split())
dp={}
def solve(x1000, x100, x1):
    if (x1000, x100, x1) in dp:
        return dp[(x1000, x100, x1)]
    ans=0
    b=db
    z1000=min(b//1000, x1000)
    b-=z1000*1000
    z100=min(b//100, x100)
    b-=z100*100
    z1=min(b, x1)
    b-=z1
    if b==0:
        ans=max(ans, solve(x1000-z1000+b1000, x100-z100+b100, x1-z1+b1)+1)
    c=dc
    z1000=min(c//1000, x1000)
    c-=z1000*1000
    z100=min(c//100, x100)
    c-=z100*100
    z1=min(c, x1)
    c-=z1
    if c==0:
        ans=max(ans, solve(x1000-z1000+c1000, x100-z100+c100, x1-z1+c1)+1)
    dp[(x1000, x100, x1)]=ans
    return ans
print(solve(a1000, a100, a1))
0