結果
問題 | No.2227 King Kraken's Attack |
ユーザー |
|
提出日時 | 2025-02-21 19:51:19 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 275 ms / 2,000 ms |
コード長 | 570 bytes |
コンパイル時間 | 3,464 ms |
コンパイル使用メモリ | 273,984 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-02-21 19:51:30 |
合計ジャッジ時間 | 10,231 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 42 |
ソースコード
#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+W+1){ ll l=-1,r=H+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(H*W-min(H,La*A)*min(W,Lb*r)<=Ka*A+Kb*r)ans=min(ans,A+r); } cout<<ans<<endl; }