結果
問題 |
No.3068 Speedrun (Hard)
|
ユーザー |
![]() |
提出日時 | 2025-03-22 02:58:30 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,123 ms / 2,000 ms |
コード長 | 1,062 bytes |
コンパイル時間 | 3,437 ms |
コンパイル使用メモリ | 275,048 KB |
実行使用メモリ | 7,328 KB |
最終ジャッジ日時 | 2025-03-22 02:58:45 |
合計ジャッジ時間 | 13,559 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 32 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; template <class T> using V=vector<T>; template <class T> using VV=V<V<T>>; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); ll a,b,c,d,n,p,q,r,s,t; cin>>a>>b>>c>>d>>n>>p>>q>>r>>s>>t; if(r==s){ for(int x=0;x<=a;x++){ for(int y=0;y<=b;y++){ if((t-x*p-y*q)%r!=0) continue; ll tmp=(t-x*p-y*q)/r; if(tmp<0 || tmp>c+d) continue; if(tmp!=n-x-y) continue; if(tmp>=c) cout<<x<<" "<<y<<" "<<c<<" "<<tmp-c<<endl; else cout<<x<<" "<<y<<" "<<tmp<<" "<<0<<endl; return 0; } } } else{ for(int x=0;x<=a;x++){ for(int y=0;y<=b;y++){ ll e=t-x*p-y*q-s*(n-x-y); if(e%(r-s)!=0) continue; ll z=e/(r-s); if(z<0 || z>c) continue; ll w=n-x-y-z; if(w<0 || w>d) continue; cout<<x<<" "<<y<<" "<<z<<" "<<w<<endl; return 0; } } } return 0; }