結果

問題 No.158 奇妙なお使い
ユーザー tnodinotnodino
提出日時 2022-07-09 21:05:55
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,201 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 87,268 KB
実行使用メモリ 78,384 KB
最終ジャッジ日時 2023-08-30 05:24:05
合計ジャッジ時間 6,711 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
76,940 KB
testcase_01 AC 163 ms
77,044 KB
testcase_02 WA -
testcase_03 AC 147 ms
77,304 KB
testcase_04 AC 213 ms
78,384 KB
testcase_05 AC 146 ms
77,024 KB
testcase_06 AC 144 ms
77,096 KB
testcase_07 AC 146 ms
77,220 KB
testcase_08 AC 144 ms
77,164 KB
testcase_09 AC 149 ms
77,100 KB
testcase_10 AC 154 ms
77,168 KB
testcase_11 AC 152 ms
77,044 KB
testcase_12 AC 150 ms
77,080 KB
testcase_13 AC 150 ms
77,452 KB
testcase_14 AC 149 ms
77,352 KB
testcase_15 AC 159 ms
77,312 KB
testcase_16 AC 155 ms
77,256 KB
testcase_17 WA -
testcase_18 AC 172 ms
77,780 KB
testcase_19 AC 143 ms
77,272 KB
testcase_20 WA -
testcase_21 AC 148 ms
77,216 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 144 ms
77,320 KB
testcase_26 WA -
testcase_27 AC 146 ms
76,904 KB
testcase_28 AC 151 ms
77,224 KB
testcase_29 AC 147 ms
77,204 KB
testcase_30 AC 154 ms
77,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def check(x1000, x100, x1, d, d1000, d100, d1):
    m = d // 1000
    if m <= x1000:
        d %= 1000
        x1000 -= m
    else:
        d -= x1000 * 1000
        x1000 = 0
    m = d // 100
    if m <= x100:
        d %= 100
        x100 -= m
    else:
        d -= x100 * 100
        x100 = 0
    if d <= x1:
        x1 -= d
        x1000 += d1000
        x100 += d100
        x1 += d1
        return True, x1000, x100, x1
    return False, -1, -1, -1

A1000,A100,A1 = map(int,input().split())
Db = int(input())
B1000,B100,B1 = map(int,input().split())
Dc = int(input())
C1000,C100,C1 = map(int,input().split())
DP = [[-1] * 101 for _ in range(11)]
DP[A1000][A100] = A1
ans = 0
for cnt in range(1,10001):
    DP2 = [[-1] * 101 for _ in range(11)]
    for i in range(11):
        for j in range(101):
            if DP[i][j] == -1:
                continue
            flg,x1000,x100,x1 = check(i, j, DP[i][j], Db, B1000, B100, B1)
            if flg:
                DP2[x1000][x100] = x1
                ans = cnt
            flg,x1000,x100,x1 = check(i, j, DP[i][j], Dc, C1000, C100, C1)
            if flg:
                DP2[x1000][x100] = x1
                ans = cnt
    DP = DP2
print(ans)
0