結果
問題 |
No.3068 Speedrun (Hard)
|
ユーザー |
![]() |
提出日時 | 2025-03-21 22:21:27 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,485 bytes |
コンパイル時間 | 1,111 ms |
コンパイル使用メモリ | 84,312 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-21 22:21:40 |
合計ジャッジ時間 | 12,246 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 WA * 2 |
ソースコード
#include <iostream> #include <vector> #include <array> using namespace std; typedef long long ll; int main() { 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 (ll i = 0; i <= A; i++) { for (ll j = 0; j <= B; j++) { ll U = T - i * P - j * Q; ll M = N - i - j; if (U < 0 || M < 0) { continue; } if (U == 0 && M == 0) { cout << i << ' ' << j << ' ' << 0 << ' ' << 0 << '\n'; exit(0); } if (R == S && U % R == 0 && U / R <= C + D) { ll tmp = U / R; if (tmp <= C) { cout << i << ' ' << j << ' ' << tmp << ' ' << 0 << '\n'; exit(0); } else { cout << i << ' ' << j << ' ' << C << ' ' << tmp - C << '\n'; exit(0); } } if (R == S) { continue; } ll tmp1 = (U - M*R), tmp2 = (S - R); if (tmp1 < 0 && tmp2 < 0) { tmp1 *= -1; tmp2 *= -1; } if (tmp1 < 0 || tmp2 < 0) { continue; } if (tmp1 % tmp2 == 0) { ll nc, nd; nd = tmp1 / tmp2; nc = M - nd; if (0 <= nc && nc <= C && 0 <= nd && nd <= D) { cout << i << ' ' << j << ' ' << nc << ' ' << nd << '\n'; exit(0); } } } } return 0; } /* File : ~/yukicoder/530/E.cpp Date : 2025/03/21 Time : 21:47:43 */