結果
問題 |
No.3068 Speedrun (Hard)
|
ユーザー |
|
提出日時 | 2025-03-22 17:36:47 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,069 bytes |
コンパイル時間 | 3,489 ms |
コンパイル使用メモリ | 274,280 KB |
実行使用メモリ | 7,328 KB |
最終ジャッジ日時 | 2025-03-22 17:37:04 |
合計ジャッジ時間 | 16,498 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 29 TLE * 3 |
ソースコード
#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++){ long long n = N - i - j, t = T - P * i - Q * j; if (n >= 0 && t >= 0) [[likely]] { if (R == S) [[unlikely]] { 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) [[likely]] { long long x = (n * S - t) / (S - R); long long y = (t - n * R) / (S - R); if (0 <= x && x <= C && 0 <= y && y <= D){ cout << i << ' ' << j << ' ' << x << ' ' << y << endl; return 0; } } } } } } }