結果

問題 No.2227 King Kraken's Attack
ユーザー ikefumyikefumy
提出日時 2023-02-24 21:57:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,177 bytes
コンパイル時間 2,169 ms
コンパイル使用メモリ 194,872 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-10 09:20:34
合計ジャッジ時間 11,572 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 4 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 3 ms
6,944 KB
testcase_13 AC 3 ms
6,940 KB
testcase_14 AC 376 ms
6,940 KB
testcase_15 AC 370 ms
6,940 KB
testcase_16 AC 379 ms
6,940 KB
testcase_17 AC 371 ms
6,944 KB
testcase_18 WA -
testcase_19 AC 372 ms
6,944 KB
testcase_20 AC 372 ms
6,944 KB
testcase_21 AC 369 ms
6,940 KB
testcase_22 AC 187 ms
6,944 KB
testcase_23 AC 20 ms
6,940 KB
testcase_24 AC 207 ms
6,944 KB
testcase_25 WA -
testcase_26 AC 377 ms
6,940 KB
testcase_27 WA -
testcase_28 AC 371 ms
6,940 KB
testcase_29 AC 371 ms
6,944 KB
testcase_30 AC 371 ms
6,944 KB
testcase_31 AC 328 ms
6,940 KB
testcase_32 AC 182 ms
6,944 KB
testcase_33 AC 146 ms
6,940 KB
testcase_34 AC 110 ms
6,940 KB
testcase_35 AC 187 ms
6,944 KB
testcase_36 AC 180 ms
6,940 KB
testcase_37 AC 136 ms
6,944 KB
testcase_38 WA -
testcase_39 AC 81 ms
6,944 KB
testcase_40 AC 90 ms
6,940 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define db double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ti3 tuple<int,int,int>
#define int128 __int128_t
#define pii128 pair<int128,int128>
const int inf = 1 << 30;
const ll linf = 1e18;
const ll mod = 1e9 + 7;
const db EPS = 1e-10;
const db pi = acos(-1);
template<class T> bool chmin(T& x, T y){
    if(x > y) {
        x = y;
        return true;
    } else return false;
}
template<class T> bool chmax(T& x, T y){
    if(x < y) {
        x = y;
        return true;
    } else return false;
}

// overload macro
#define CAT( A, B ) A ## B
#define SELECT( NAME, NUM ) CAT( NAME, NUM )

#define GET_COUNT( _1, _2, _3, _4, _5, _6 /* ad nauseam */, COUNT, ... ) COUNT
#define VA_SIZE( ... ) GET_COUNT( __VA_ARGS__, 6, 5, 4, 3, 2, 1 )

#define VA_SELECT( NAME, ... ) SELECT( NAME, VA_SIZE(__VA_ARGS__) )(__VA_ARGS__)

// rep(overload)
#define rep( ... ) VA_SELECT(rep, __VA_ARGS__)
#define rep2(i, n) for (decay_t<decltype(n)> i = 0; i < n; i++)
#define rep3(i, a, b) for (decay_t<decltype(a)> i = a; i < b; i++)
#define rep4(i, a, b, c) for (decay_t<decltype(a)> i = a; i < b; i += c)

// rrep(overload)
#define rrep( ... ) VA_SELECT(rrep, __VA_ARGS__)
#define rrep2(i, n) for (decay_t<decltype(n)> i = n - 1; i >= 0; i--)
#define rrep3(i, a, b) for (decay_t<decltype(a)> i = b - 1; i >= a; i--)
#define rrep4(i, a, b, c) for (decay_t<decltype(a)> i = b - 1; i >= a; i -= c)

// for_earh
#define fore(e, v) for (auto&& e : v)

// vector
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    ll H, W, LA, LB, KA, KB;
    cin >> H >> W >> LA >> LB >> KA >> KB;
    ll ans = linf;
    rep (i, H + W + 1) {
        ll h = min(H, i * LA);
        ll lb = -1, ub = inf;
        while (ub - lb > 1) {
            ll mid = (ub + lb) / 2;
            ll w = min(W, mid * LB);
            if (w * h + i * KA + mid * KB >= H * W) ub = mid;
            else lb = mid;
        }
        chmin(ans, ub + i);
    }
    cout << ans << "\n";
}
0