結果

問題 No.3068 Speedrun (Hard)
ユーザー 👑 AngrySadEight
提出日時 2025-02-19 00:29:49
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 973 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 90 ms
コンパイル使用メモリ 64,640 KB
実行使用メモリ 58,764 KB
最終ジャッジ日時 2026-11-11 04:20:11
合計ジャッジ時間 6,156 ms
ジャッジサーバーID
(参考情報)
judge7_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 37 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

for a in range(A + 1):
    for b in range(B + 1):
        rem_n = N - a - b
        rem_t = T - a * P - b * Q

        if R == S:
            if rem_n * R != rem_t:
                continue
            else:
                if C + D < rem_n:
                    continue
                else:
                    nc = min(C, rem_n)
                    print(a, b, nc, rem_n - nc)
                    exit()
        elif R < S:
            if (rem_n * S - rem_t) % (S - R) != 0:
                continue
            c = (rem_n * S - rem_t) // (S - R)
            d = rem_n - c
            if c >= 0 and c <= C and d >= 0 and d <= D:
                print(a, b, c, d)
                exit()
        else:
            c = (rem_t - rem_n * S) // (R - S)
            d = rem_n - c
            if c >= 0 and c <= C and d >= 0 and d <= D:
                print(a, b, c, d)
                exit()
0