結果

問題 No.3068 Speedrun (Hard)
ユーザー daiota
提出日時 2025-03-21 23:19:41
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 820 bytes
コンパイル時間 1,996 ms
コンパイル使用メモリ 161,696 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-03-21 23:19:50
合計ジャッジ時間 8,902 ms
ジャッジサーバーID
(参考情報)
judge1 / judge7
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 26 WA * 6
権限があれば一括ダウンロードができます

ソースコード

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,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(u==0){
				if(N-i-j>a+b) continue;
				else{
					cout << a << ' ' << N-i-j-a << ' ' << j << ' ' << i << endl;
					return 0;
				}
			}
			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