結果
| 問題 |
No.2227 King Kraken's Attack
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-24 22:26:09 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 747 bytes |
| コンパイル時間 | 4,494 ms |
| コンパイル使用メモリ | 250,876 KB |
| 最終ジャッジ日時 | 2025-02-10 21:29:53 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 41 WA * 1 |
ソースコード
#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();
}