結果

問題 No.3068 Speedrun (Hard)
ユーザー norioc
提出日時 2025-03-22 07:33:58
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 473 bytes
コンパイル時間 403 ms
コンパイル使用メモリ 82,248 KB
実行使用メモリ 60,060 KB
最終ジャッジ日時 2025-03-22 07:34:06
合計ジャッジ時間 7,218 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 3 WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

A, B, C, D, N = map(int, input().split())
P, Q, R, S, T = map(int, input().split())


def solve():
    if S == R: return None

    for a in range(A):
        for b in range(B):
            n = N - a - b
            t = T - a*P - b*Q

            d = (t - n*R) // (S - R)
            c = n - d

            if a+b+c+d == N and a*P + b*Q + c*R + d*S == T:
                return a, b, c, d

    return None


ans = solve()
if ans is None:
    print(-1)
else:
    print(*ans)
0