結果

問題 No.3068 Speedrun (Hard)
ユーザー kenti
提出日時 2025-03-23 19:18:23
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 931 bytes
コンパイル時間 2,145 ms
コンパイル使用メモリ 192,704 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-23 19:18:33
合計ジャッジ時間 9,099 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    ll a, b, c, d, n; cin >> a >> b >> c >> d >> n;
    ll p, q, r, s, t; cin >> p >> q >> r >> s >> t;
    for (int i = 0; i <= a; i++) {
        for (int j = 0; j <= b; j++) {
            int res = t - s * n - (p - s) * i - (q - s) * j;
            if (r - s == 0) {
                if (res == 0 && i + j + c + d >= n) {
                    cout << i << " " << j << " " << c << " " << n - i - j - c << "\n";
                    return 0;
                }
            } else if (res % (r - s) == 0) {
                int k = res / (r - s), l = n - i - j - k;
                if (k >= 0 && k <= c && l >= 0 && l <= d) {
                    cout << i << " " << j << " " << k << " " << l << "\n";
                    return 0;
                }
            }
        }
    }
    return 0;
}
0