結果

問題 No.2227 King Kraken's Attack
ユーザー ttkkggwwttkkggww
提出日時 2023-02-24 22:17:33
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 638 bytes
コンパイル時間 4,245 ms
コンパイル使用メモリ 251,608 KB
最終ジャッジ日時 2025-02-10 21:20:13
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
using ll = long long;
ll H,W,LA,LB,KA,KB;

ll bs(ll A){//Akai punch
	ll yoko = min(H,LA*A);
	ll Aboth = min(H*W,KA*A);
	ll ng = -1,ok = 1e9;
	while(abs(ok-ng)>1){
		ll mid = (ok+ng)/2;
		ll tate = min(W,LB*mid);
		ll Bboth = min(H*W,KB*mid);
		if(tate*yoko+Aboth+Bboth>=H*W){
			ok = mid;
		}else{
			ng = mid;
		}
	}
	return ok;
}

void solve(){
	ll ans = 1e9;
	for(int i = 0;i<=H;i++){
		ans = min(ans,bs(i)+i);
	}
	cout<<ans<<endl;
}

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cin >> H >> W>>LA>>LB>>KA>>KB;
	solve();
}
0