結果

問題 No.2227 King Kraken's Attack
ユーザー umimelumimel
提出日時 2023-02-24 22:44:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,290 bytes
コンパイル時間 1,583 ms
コンパイル使用メモリ 163,388 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-10 09:33:45
合計ジャッジ時間 2,902 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 WA -
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 29 ms
6,944 KB
testcase_15 AC 15 ms
6,940 KB
testcase_16 AC 14 ms
6,940 KB
testcase_17 AC 27 ms
6,944 KB
testcase_18 AC 3 ms
6,944 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 7 ms
6,940 KB
testcase_25 AC 14 ms
6,940 KB
testcase_26 AC 26 ms
6,940 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 2 ms
6,940 KB
testcase_38 AC 2 ms
6,944 KB
testcase_39 WA -
testcase_40 AC 2 ms
6,940 KB
testcase_41 AC 1 ms
6,940 KB
testcase_42 AC 2 ms
6,940 KB
testcase_43 AC 2 ms
6,944 KB
testcase_44 AC 1 ms
6,940 KB
testcase_45 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
#define drep(i, cc, n) for (ll i = (cc); i <= (n); ++i)
#define rep(i, n) drep(i, 0, n - 1)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define fi first
#define se second

const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll INF = 1LL << 60;
const ll MAX_N = 2e5;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    ll h, w, la, lb, ka, kb; cin >> h >> w >> la >> lb >> ka >> kb;

    ll ans = INF;
    for(ll a=0; a<=(h+la-1)/la; a++){
        if(a*ka >= h*w){
            ans = min(ans, a);
        }else{
            if(min(a*la, h)*lb+kb==0) continue;
            ll b = (h*w-a*ka + min(a*la, h)*lb+kb-1)/(min(a*la, h)*lb+kb);

            if(min(a*la, h)*min(b*lb, w)+a*ka+b*ka >= h*w){
                ans = min(ans, a+b);
            }
        }
    }

    for(ll b=0; b<=(w+lb-1)/lb; b++){
        if(b*kb >= h*w){
            ans = min(ans, b);
        }else{
            if(min(b*lb, w)*la+ka==0) continue;
            ll a = (h*w-b*kb + min(b*lb, w)*la+ka-1)/(min(b*lb, w)*la+ka);
            if(min(a*la, h)*min(b*lb, w)+a*ka+b*ka >= h*w){
                ans = min(ans, a+b);
            }
        }
    }

    cout << ans << endl;
}
0