結果

問題 No.3068 Speedrun (Hard)
ユーザー hirakuuuu
提出日時 2025-03-21 22:04:55
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 3,020 bytes
コンパイル時間 3,230 ms
コンパイル使用メモリ 277,592 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-03-21 22:05:07
合計ジャッジ時間 11,504 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 17 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
#define rep(i, a, n) for(ll i = a; i < n; i++)
#define rrep(i, a, n) for(int i = a; i >= n; i--)
#define inr(l, x, r) (l <= x && x < r)
#define ll long long
#define ld long double
// using mint = modint1000000007;
// using mint = modint998244353;
constexpr int IINF = 1001001001;
constexpr ll INF = 1e18;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
int main(){
vector<ll> a(4);
rep(i, 0, 4) cin >> a[i];
ll n; cin >> n;
vector<ll> t(4);
rep(i, 0, 4) cin >> t[i];
ll T; cin >> T;
rep(x1, 0, a[0]+1){
if(x1*t[0] > T || x1 > n) break;
rep(x2, 0, a[1]+1){
if(x1*t[0]+x2*t[1] > T || x1+x2 > n) break;
if(x1*t[0]+x2*t[1] > T) break;
ll rest = T-x1*t[0]-x2*t[1];
ll rp = n-x1-x2;
// cout << x1 << ' ' << x2 << endl;
// x2*t[2]+x3*t[3] <= rest;
if(t[2]-t[3] == 0){
if(t[3]*rp > rest) continue;
ll x3 = 0;
// cout << "###" << x1 << ' ' << x2 << ' ' << x3 << endl;
if(inr(0, n-x1-x2-x3, a[3]+1)){
cout << x1 << ' ' << x2 << ' ' << x3 << ' ' << n-x1-x2-x3 << endl;
return 0;
}
x3 = a[2];
if(inr(0, n-x1-x2-x3, a[3]+1)){
cout << x1 << ' ' << x2 << ' ' << x3 << ' ' << n-x1-x2-x3 << endl;
return 0;
}
}else if(t[2]-t[3] > 0){
if(t[3]*rp > rest) continue;
ll mx = (rest-t[3]*rp)/(t[2]-t[3]);
ll x3 = 0;
if(inr(0, n-x1-x2-x3, a[3]+1)){
cout << x1 << ' ' << x2 << ' ' << x3 << ' ' << n-x1-x2-x3 << endl;
return 0;
}
x3 = min(a[2], mx);
if(inr(0, n-x1-x2-x3, a[3]+1)){
cout << x1 << ' ' << x2 << ' ' << x3 << ' ' << n-x1-x2-x3 << endl;
return 0;
}
}else{
ll mi = 0;
if(t[3]*rp >= rest){
mi = (t[3]*rp-rest)/(t[3]-t[2]);
}
if(mi > a[2]) continue;
ll x3 = mi;
// cout << "###" << x1 << ' ' << x2 << ' ' << x3 << ' ' << n-x1-x2-x3 << endl;
if(inr(0, n-x1-x2-x3, a[3]+1)){
cout << x1 << ' ' << x2 << ' ' << x3 << ' ' << n-x1-x2-x3 << endl;
return 0;
}
x3 = a[2];
// cout << "###" << x1 << ' ' << x2 << ' ' << x3 << ' ' << n-x1-x2-x3 << endl;
if(inr(0, n-x1-x2-x3, a[3]+1)){
cout << x1 << ' ' << x2 << ' ' << x3 << ' ' << n-x1-x2-x3 << endl;
return 0;
}
}
}
}
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0