結果
問題 |
No.3068 Speedrun (Hard)
|
ユーザー |
|
提出日時 | 2025-03-21 23:53:29 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,290 ms / 2,000 ms |
コード長 | 1,775 bytes |
コンパイル時間 | 2,080 ms |
コンパイル使用メモリ | 194,288 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-21 23:53:40 |
合計ジャッジ時間 | 10,272 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 32 |
ソースコード
#ifndef INCLUDED_MAIN #define INCLUDED_MAIN #include __FILE__ int main(){ ll a,b,c,d,p,q,r,s,t,n; cin>>a>>b>>c>>d>>n>>p>>q>>r>>s>>t; srep(x1,0,a){ srep(x2,0,b){ ll qrem=n-x1-x2; ll trem=t-p*x1-q*x2; if(r==s){ if(r*qrem!=trem)continue; if(c+d<qrem)continue; ll x3=min(c,qrem); ll x4=qrem-x3; if(x4>d)continue; cout<<x1<<" "<<x2<<" "<<x3<<" "<<x4<<nl; return 0; } else{ if(r<s){ if((qrem*s-trem)%(s-r)!=0)continue; ll x3=(qrem*s-trem)/(s-r); ll x4=qrem-x3; if(x3<0||x4<0)continue; if(x3<=c&&x4<=d){ cout<<x1<<" "<<x2<<" "<<x3<<" "<<x4<<"\n"; return 0; } } else{ if((trem-qrem*s)%(r-s)!=0)continue; ll x3=(trem-qrem*s)/(r-s); ll x4=qrem-x3; if(x3<0||x4<0)continue; if(x3<=c&&x4<=d){ cout<<x1<<" "<<x2<<" "<<x3<<" "<<x4<<"\n"; return 0; } } } } } } /////// library zone /////// #else #include <bits/stdc++.h> using namespace std; #define rep(i,n) for(ll i=0;i<n;i++) #define srep(i,l,r) for(ll i=l;i<=r;i++) using ll=long long; const ll mod=998244353; #define vout(v) for(auto i:v) cout<<i<<" "; #define INF 9223300000000000000ll #define Winf 5e12 #define nl "\n" #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() #define vl vector<ll> #endif