結果
| 問題 |
No.2227 King Kraken's Attack
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-09-05 06:51:21 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,737 bytes |
| コンパイル時間 | 3,991 ms |
| コンパイル使用メモリ | 231,176 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-05 06:51:35 |
| 合計ジャッジ時間 | 13,722 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 3 |
| other | AC * 17 WA * 25 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, p, n) for (ll i = p; i < (ll)(n); i++)
#define rep2(i, p, n) for (ll i = p; i >= (ll)(n); i--)
using namespace std;
using ll = long long;
using ld = long double;
const double pi = 3.141592653589793;
const long long inf = 2 * 1e9;
const long long linf = 4 * 1e18;
const ll mod1 = 1000000007;
const ll mod2 = 998244353;
template <class T>
inline bool chmax(T &a, T b)
{
if (a < b)
{
a = b;
return 1;
}
return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
if (a > b)
{
a = b;
return 1;
}
return 0;
}
// atcoder
#include <atcoder/all>
using namespace atcoder;
using mint1 = modint1000000007;
using mint2 = modint998244353;
vector<pair<ll, ll>> base = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
int main()
{
//////////////////
ios::sync_with_stdio(false);
cin.tie(nullptr);
//////////////////
ll H, W, La, Lb, Ka, Kb;
cin >> H >> W >> La >> Lb >> Ka >> Kb;
ll ans = linf;
rep(i, 0, 1000001)
{
if (i==0) {
if (Kb>0) {
ans = (H * W - 1) / Kb + 1;
}
continue;
}
//cout << ans << endl;
ll P = 1e12 / min(La*i, H) / Lb;
ll ok = 1e12 + 1, ng = -1;
while(ok-ng>1) {
ll mid = ok + ng;
mid /= 2;
if (mid>P) {
ok = mid;
continue;
}
if (min(H, i*La)*min(W, Lb*mid)+i*Ka+mid*Kb>=H*W) {
ok = mid;
}
else {
ng = mid;
}
}
chmin(ans, i + ok);
if (i+ok==2001) {
cout << i << " " << ok << endl;
}
}
cout << ans;
}