結果

問題 No.2227 King Kraken's Attack
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-07-14 04:20:36
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 208 ms / 2,000 ms
コード長 683 bytes
コンパイル時間 3,083 ms
コンパイル使用メモリ 243,044 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-10-13 16:40:51
合計ジャッジ時間 7,677 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,352 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,352 KB
testcase_10 AC 1 ms
4,352 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 1 ms
4,356 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 208 ms
4,352 KB
testcase_15 AC 206 ms
4,348 KB
testcase_16 AC 203 ms
4,348 KB
testcase_17 AC 107 ms
4,352 KB
testcase_18 AC 5 ms
4,352 KB
testcase_19 AC 203 ms
4,352 KB
testcase_20 AC 207 ms
4,352 KB
testcase_21 AC 207 ms
4,352 KB
testcase_22 AC 97 ms
4,352 KB
testcase_23 AC 6 ms
4,352 KB
testcase_24 AC 108 ms
4,348 KB
testcase_25 AC 195 ms
4,352 KB
testcase_26 AC 207 ms
4,356 KB
testcase_27 AC 5 ms
4,376 KB
testcase_28 AC 203 ms
4,352 KB
testcase_29 AC 204 ms
4,352 KB
testcase_30 AC 204 ms
4,352 KB
testcase_31 AC 179 ms
4,352 KB
testcase_32 AC 97 ms
4,352 KB
testcase_33 AC 80 ms
4,352 KB
testcase_34 AC 66 ms
4,352 KB
testcase_35 AC 102 ms
4,352 KB
testcase_36 AC 99 ms
4,352 KB
testcase_37 AC 2 ms
4,352 KB
testcase_38 AC 2 ms
4,348 KB
testcase_39 AC 2 ms
4,352 KB
testcase_40 AC 2 ms
4,352 KB
testcase_41 AC 4 ms
4,352 KB
testcase_42 AC 2 ms
4,352 KB
testcase_43 AC 3 ms
4,348 KB
testcase_44 AC 5 ms
4,348 KB
testcase_45 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
 
using ll=long long;
using pp=pair<int,int>;
#define sr string 
#define vc vector
#define db double
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define pque priority_queue
#define bpc(a) __builtin_popcount(a)
int main(){
	ll h,w,ah,aw,bh,bw;cin>>h>>w>>ah>>aw>>bh>>bw;
	ll ans=h+w;
	for(ll i=0;i<h+w;i++){
		ll x=min(h,i*ah);
		ll r=h*w-i*bh;
		if(r<=0){
			ans=min(ans,i);
			continue;
		}
		ll wa=0,ac=h+w;
		while(ac-wa>1){
			ll m=(ac+wa)/2;
			ll now=min(w,aw*m)*x+m*bw;
			if(now>=r)ac=m;
			else wa=m;
		}
		ans=min(ans,ac+i);
	}
	cout<<ans;
}
0