結果

問題 No.2227 King Kraken's Attack
ユーザー ttkkggwwttkkggww
提出日時 2023-02-24 22:26:09
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 747 bytes
コンパイル時間 4,742 ms
コンパイル使用メモリ 253,852 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-10 09:30:31
合計ジャッジ時間 8,942 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 134 ms
6,940 KB
testcase_15 AC 134 ms
6,940 KB
testcase_16 AC 134 ms
6,940 KB
testcase_17 AC 134 ms
6,940 KB
testcase_18 AC 126 ms
6,944 KB
testcase_19 AC 134 ms
6,944 KB
testcase_20 AC 133 ms
6,944 KB
testcase_21 AC 132 ms
6,940 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 113 ms
6,940 KB
testcase_25 AC 134 ms
6,944 KB
testcase_26 AC 133 ms
6,944 KB
testcase_27 AC 126 ms
6,940 KB
testcase_28 AC 133 ms
6,940 KB
testcase_29 AC 133 ms
6,940 KB
testcase_30 AC 134 ms
6,940 KB
testcase_31 AC 126 ms
6,940 KB
testcase_32 AC 98 ms
6,940 KB
testcase_33 AC 66 ms
6,940 KB
testcase_34 AC 40 ms
6,940 KB
testcase_35 AC 103 ms
6,944 KB
testcase_36 AC 49 ms
6,944 KB
testcase_37 AC 26 ms
6,944 KB
testcase_38 AC 33 ms
6,944 KB
testcase_39 AC 39 ms
6,944 KB
testcase_40 AC 29 ms
6,944 KB
testcase_41 AC 110 ms
6,940 KB
testcase_42 AC 23 ms
6,944 KB
testcase_43 AC 28 ms
6,944 KB
testcase_44 AC 96 ms
6,940 KB
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

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 = W+2;
	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;
		}
	}
	ll tate = min(W,LB*ok);
	ll Bboth = min(H*W,KB*ok);
	if(tate*yoko+Aboth+Bboth>=H*W){
	}else{
		ok = 1e9;
	}
	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