結果
| 問題 |
No.2227 King Kraken's Attack
|
| コンテスト | |
| ユーザー |
planes
|
| 提出日時 | 2023-02-24 21:58:51 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 316 ms / 2,000 ms |
| コード長 | 806 bytes |
| コンパイル時間 | 1,567 ms |
| コンパイル使用メモリ | 168,480 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-02 11:09:29 |
| 合計ジャッジ時間 | 4,793 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 42 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
ll INF=2e18;
int main() {
ll H,W;
cin>>H>>W;
pair<ll,ll> L,K;
cin>>L.first>>L.second;
cin>>K.first>>K.second;
ll ans=INF;
if(K.first>0) {
ans=min(ans,(H*W+K.first-1)/K.first);
}
if(K.second>0) {
ans=min(ans,(H*W+K.second-1)/K.second);
}
for(ll i=1;i<=W;i++) {
ll t=(i+L.second-1)/L.second;
if(H*W-i*H>t*K.second+K.first*((H+L.first-1)/L.first)) continue;
ll s=1,g=H;
while(s<g) {
ll k=(s+g)/2;
ll t2=(k+L.first-1)/L.first;
ll count=t*K.second+t2*K.first;
if(H*W-i*k<=count) g=k;
else s=k+1;
}
ans=min(ans,t+(s+L.first-1)/L.first);
}
cout<<ans<<endl;
}
planes