結果

問題 No.2227 King Kraken's Attack
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-07-14 04:17:16
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 691 bytes
コンパイル時間 3,275 ms
コンパイル使用メモリ 243,152 KB
実行使用メモリ 4,476 KB
最終ジャッジ日時 2023-10-13 16:37:29
合計ジャッジ時間 10,054 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 RE -
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 3 ms
4,352 KB
testcase_04 RE -
testcase_05 AC 2 ms
4,348 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,352 KB
testcase_11 RE -
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 AC 115 ms
4,348 KB
testcase_18 AC 3 ms
4,348 KB
testcase_19 RE -
testcase_20 AC 379 ms
4,352 KB
testcase_21 AC 336 ms
4,348 KB
testcase_22 AC 100 ms
4,352 KB
testcase_23 AC 6 ms
4,352 KB
testcase_24 AC 218 ms
4,348 KB
testcase_25 AC 24 ms
4,348 KB
testcase_26 RE -
testcase_27 AC 3 ms
4,348 KB
testcase_28 AC 266 ms
4,348 KB
testcase_29 AC 260 ms
4,348 KB
testcase_30 AC 267 ms
4,352 KB
testcase_31 AC 251 ms
4,348 KB
testcase_32 AC 107 ms
4,348 KB
testcase_33 AC 90 ms
4,348 KB
testcase_34 AC 69 ms
4,352 KB
testcase_35 AC 120 ms
4,348 KB
testcase_36 AC 146 ms
4,352 KB
testcase_37 AC 2 ms
4,348 KB
testcase_38 AC 2 ms
4,348 KB
testcase_39 AC 1 ms
4,352 KB
testcase_40 AC 2 ms
4,348 KB
testcase_41 AC 3 ms
4,352 KB
testcase_42 AC 2 ms
4,352 KB
testcase_43 AC 2 ms
4,352 KB
testcase_44 AC 3 ms
4,352 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=(r+bw-1)/bw;
		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