結果

問題 No.3068 Speedrun (Hard)
ユーザー Leal-0
提出日時 2025-03-21 23:21:17
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 953 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 82,740 KB
実行使用メモリ 63,224 KB
最終ジャッジ日時 2025-03-21 23:21:29
合計ジャッジ時間 11,713 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
data = sys.stdin.read().split()
if data:
    a, b, c, d, n, p, q, r, s, t = map(int, data)
    for x1 in range(0, min(n, a) + 1):
        for x2 in range(0, min(n - x1, a) + 1):
            qrem = n - x1 - x2
            trem = t - p * x1 - q * x2
            if r == s:
                if r * qrem != trem:
                    continue
                L = max(0, qrem - d)
                R = min(qrem, c)
                if L > R:
                    continue
                x3 = L
                x4 = qrem - x3
                print(x1, x2, x3, x4)
                sys.exit(0)
            else:
                if (trem - s * qrem) % (r - s) != 0:
                    continue
                x3 = (trem - s * qrem) // (r - s)
                x4 = qrem - x3
                if x3 < 0 or x4 < 0:
                    continue
                if x3 <= c and x4 <= d:
                    print(x1, x2, x3, x4)
                    sys.exit(0)
0