結果

問題 No.2227 King Kraken's Attack
ユーザー TKTYI
提出日時 2025-02-21 19:48:27
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 532 bytes
コンパイル時間 3,442 ms
コンパイル使用メモリ 275,260 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-02-21 19:48:34
合計ジャッジ時間 7,433 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 41 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define all(a) begin(a),end(a)
#define sz(a) (int)(a).size()
typedef long long ll;
int main(){
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);
    ll H,W,La,Lb,Ka,Kb;cin>>H>>W>>La>>Lb>>Ka>>Kb;
    ll ans=1e18;
    rep(A,0,H+1){
    	ll l=-1,r=W+1;
    	while(r-l>1){
      		ll m=(l+r)/2;
      		if(H*W-min(H,La*A)*min(W,Lb*m)<=Ka*A+Kb*m)r=m;
      		else l=m;
    	}
    	if(r<=W)ans=min(ans,A+r);
    }
    cout<<ans<<endl;
}
0