結果
問題 | No.2227 King Kraken's Attack |
ユーザー |
![]() |
提出日時 | 2023-07-14 04:20:36 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 234 ms / 2,000 ms |
コード長 | 683 bytes |
コンパイル時間 | 2,922 ms |
コンパイル使用メモリ | 243,160 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-15 12:38:49 |
合計ジャッジ時間 | 7,823 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 42 |
ソースコード
#include<bits/stdc++.h>using namespace std;using ll=long long;using pp=pair<int,int>;#define sr string#define vc vector#define db double#define fi first#define se second#define rep(i,n) for(int i=0;i<(int)n;i++)#define pb push_back#define all(v) v.begin(),v.end()#define pque priority_queue#define bpc(a) __builtin_popcount(a)int main(){ll h,w,ah,aw,bh,bw;cin>>h>>w>>ah>>aw>>bh>>bw;ll ans=h+w;for(ll i=0;i<h+w;i++){ll x=min(h,i*ah);ll r=h*w-i*bh;if(r<=0){ans=min(ans,i);continue;}ll wa=0,ac=h+w;while(ac-wa>1){ll m=(ac+wa)/2;ll now=min(w,aw*m)*x+m*bw;if(now>=r)ac=m;else wa=m;}ans=min(ans,ac+i);}cout<<ans;}