結果
問題 |
No.3068 Speedrun (Hard)
|
ユーザー |
|
提出日時 | 2025-03-21 23:21:20 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 765 bytes |
コンパイル時間 | 1,908 ms |
コンパイル使用メモリ | 195,836 KB |
実行使用メモリ | 28,160 KB |
最終ジャッジ日時 | 2025-03-21 23:21:34 |
合計ジャッジ時間 | 13,735 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge7 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 12 WA * 14 RE * 6 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; #include<atcoder/modint> using namespace atcoder; using mint=modint998244353; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll A[5],P[5]; for(int i=0;i<5;i++)cin>>A[i]; for(int i=0;i<5;i++)cin>>P[i]; bitset<200000000> BS; for(ll a=0;a<=A[0];a++){ for(ll b=0;b<=A[1];b++){ ll S=a*P[0]+b*P[1]; if(S>P[4])continue; BS[P[4]-S]=1; } } for(ll c=0;c<=A[2];c++){ for(ll d=0;d<=A[3];d++){ ll S=c*P[2]+d*P[3]; if(S>P[4])continue; if(BS[S]){ for(ll a=0;a<=A[0];a++){ for(ll b=0;b<=A[1];b++){ ll T=a*P[0]+b*P[1]; if(P[4]-T==S){ cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl; return 0; } } } } } } }