結果
| 問題 |
No.2227 King Kraken's Attack
|
| コンテスト | |
| ユーザー |
ineedyourlovep
|
| 提出日時 | 2023-02-24 23:05:24 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 114 ms / 2,000 ms |
| コード長 | 637 bytes |
| コンパイル時間 | 1,686 ms |
| コンパイル使用メモリ | 192,408 KB |
| 最終ジャッジ日時 | 2025-02-10 22:18:38 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 42 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, a, n) for(ll 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 = 10000005, 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;
}
ineedyourlovep