結果

問題 No.2227 King Kraken's Attack
ユーザー ineedyourlovepineedyourlovep
提出日時 2023-02-24 23:02:50
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 637 bytes
コンパイル時間 1,688 ms
コンパイル使用メモリ 193,604 KB
最終ジャッジ日時 2025-02-10 22:12:52
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 40 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
//const int mod = 1000000007;
//const int mod = 998244353;

int main()
{
  ll h, w, a, b, c, d;
  cin >> h >> w >> a >> b >> c >> d;
  ll ans = LINF;
  rep(i, 0, 1000005) {
    ll ub = 1000005, lb = -1;
    while (ub - lb > 1) {
      ll mid = (ub + lb)>>1;
      if (i*c + mid*d + min((ll)i*a, h)*min(mid*b, w) >= h*w) ub = mid;
      else lb = mid;
    }
    ans = min(ans, i + ub);
  }
  cout << ans << endl;
  return 0;
}
0