結果

問題 No.3068 Speedrun (Hard)
ユーザー daiota
提出日時 2025-03-21 22:52:18
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 683 bytes
コンパイル時間 1,595 ms
コンパイル使用メモリ 161,860 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-21 22:52:30
合計ジャッジ時間 10,418 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18 RE * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i=0;i<ll(n);i++)










int main(void){
	cin.tie(nullptr);  ios_base::sync_with_stdio(false);
	ll i,j;





	ll a,b,c,d,N;
	cin >> a >> b >> c >> d >> N;
	ll p,q,r,s,T;
	cin >> p >> q >> r >> s >> T;

	ll na,nb,nc,nd;
	ll X=T-s*N;
	for(i=0;i<=c;i++){
		ll W=X-(r-s)*i;
		ll u=p-s,v=q-s;
		for(j=0;j<=b;j++){
			if((W-v*j)%u==0){
				na=(W-v*j)/u;
				if(na<0 || na>a) continue;
				nd=N-na-j-i;
				if(nd<0 || nd>d) continue;

				cout << na << ' ' << j << ' ' << i << ' ' << nd << endl;
				return 0;

			}else{
				continue;
			}
		}

	}










	return 0;
}
0