結果
| 問題 |
No.3068 Speedrun (Hard)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-03-21 23:33:54 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,380 bytes |
| コンパイル時間 | 1,974 ms |
| コンパイル使用メモリ | 195,648 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-21 23:34:06 |
| 合計ジャッジ時間 | 10,706 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge7 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 26 WA * 6 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> istream& operator >> (istream& is, vector<T>& vec) {
for(T& x : vec) is >> x;
return is;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
ll t, n;
vector<ll> a(4), b(4);
cin >> a >> n >> b >> t;
const ll d = b[2] - b[3];
for(ll i = 0; i <= n && i <= a[0] && i * b[0] <= t; i++){
for(ll j = 0; i + j <= n && j <= a[1] && i * b[0] + j * b[1] <= t; j++){
ll rt = t - (i * b[0] + j * b[1]);
ll r = n - (i + j);
// Ax + B * (r - x) = rt
// (A - B) * x + B * r == rt
ll rhs = rt - b[3] * r;
if(rhs == 0 && r <= a[3]){
cout << i << " " << j << " " << 0 << " " << r << '\n';
return 0;
}
if(d == 0){
ll c2 = min(a[2], r), c3 = r - c2;
if(c3 <= a[3]){
cout << i << " " << j << " " << c2 << " " << c3 << '\n';
return 0;
}
continue;
}
if(rhs % d != 0) continue;
ll c2 = rhs / d, c3 = r - c2;
if(0 <= c2 && c2 <= a[2] && 0 <= c3 && c3 <= a[3]){
cout << i << " " << j << " " << c2 << " " << c3 << '\n';
return 0;
}
}
}
}