結果
問題 | No.3068 Speedrun (Hard) |
ユーザー |
![]() |
提出日時 | 2025-03-21 22:05:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 865 ms / 2,000 ms |
コード長 | 1,012 bytes |
コンパイル時間 | 2,038 ms |
コンパイル使用メモリ | 193,668 KB |
実行使用メモリ | 5,888 KB |
最終ジャッジ日時 | 2025-03-21 22:05:33 |
合計ジャッジ時間 | 8,177 ms |
ジャッジサーバーID (参考情報) |
judge7 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 32 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main(){int A, B, C, D, N;cin >> A >> B >> C >> D >> N;int 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 n = N - i - j, t = T - P * i - Q * j;if (n >= 0 && t >= 0){if (R == S){if (t == R * n){if (n <= C){cout << i << ' ' << j << ' ' << n << ' ' << 0 << endl;return 0;} else if (n <= C + D){cout << i << ' ' << j << ' ' << C << ' ' << n - C << endl;return 0;}}} else {if ((n * S - t) % (S - R) == 0 && (t - n * R) % (S - R) == 0){int x = (n * S - t) / (S - R);int y = (t - n * R) / (S - R);if (0 <= x && x <= C && 0 <= y && y <= D){cout << i << ' ' << j << ' ' << x << ' ' << y << endl;return 0;}}}}}}}