結果
| 問題 |
No.3068 Speedrun (Hard)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-03-22 17:38:26 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,069 bytes |
| コンパイル時間 | 5,291 ms |
| コンパイル使用メモリ | 170,708 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-22 17:38:45 |
| 合計ジャッジ時間 | 16,415 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}
}
}
}
}
}
}