結果
問題 |
No.2227 King Kraken's Attack
|
ユーザー |
|
提出日時 | 2024-09-28 20:26:47 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,210 bytes |
コンパイル時間 | 1,121 ms |
コンパイル使用メモリ | 111,560 KB |
最終ジャッジ日時 | 2025-02-24 14:03:52 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 34 WA * 8 |
ソースコード
#include<iostream> #include<string> #include<queue> #include<vector> #include<cassert> #include<random> #include<set> #include<map> #include<cassert> #include<unordered_map> #include<bitset> #include<numeric> #include<algorithm> using namespace std; typedef long long ll; const int inf=1<<30; const ll INF=1LL<<62; typedef pair<int,ll> P; typedef pair<int,P> PP; const ll MOD=998244353; int main(){ ll H,W,LA,LB,KA,KB; cin>>H>>W>>LA>>LB>>KA>>KB; ll ans=inf; for(ll a=0;a<=(H+W);a++){ ll ub=inf;//ubは必ず達成できる ll lb=-1; //今、a回横パンチを行ったとする // ll cH=H; // ll h=min(a*LA,H); // if(h==H){ // }else{ // //h<H // //W/(LA*KA)の行ぶんが消える // cH=cH-W/(LA*KA); // } while(ub-lb>1){ ll mid=(ub+lb)/2; ll c=min(H,a*LA)*min(W,mid*LB)+a*KA+mid*KB; if(c>=H*W){ ub=mid; }else{ lb=mid; } } if(lb==inf-1){ continue;//横パンチがa回では無理 } ans=min(ans,a+ub); } cout<<ans<<endl; }