結果

問題 No.2227 King Kraken's Attack
ユーザー norikamenorikame
提出日時 2023-01-19 02:49:28
言語 Java21
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 946 bytes
コンパイル時間 3,581 ms
コンパイル使用メモリ 78,016 KB
実行使用メモリ 54,640 KB
最終ジャッジ日時 2024-04-10 09:15:19
合計ジャッジ時間 11,908 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
54,244 KB
testcase_01 AC 135 ms
54,436 KB
testcase_02 AC 135 ms
54,136 KB
testcase_03 AC 135 ms
53,824 KB
testcase_04 AC 136 ms
54,052 KB
testcase_05 AC 135 ms
54,252 KB
testcase_06 AC 137 ms
54,192 KB
testcase_07 AC 135 ms
54,256 KB
testcase_08 AC 134 ms
54,096 KB
testcase_09 AC 137 ms
54,240 KB
testcase_10 AC 137 ms
53,996 KB
testcase_11 AC 135 ms
54,032 KB
testcase_12 AC 135 ms
53,916 KB
testcase_13 AC 134 ms
54,252 KB
testcase_14 AC 200 ms
53,972 KB
testcase_15 AC 135 ms
54,004 KB
testcase_16 AC 151 ms
54,104 KB
testcase_17 AC 282 ms
53,928 KB
testcase_18 AC 203 ms
54,156 KB
testcase_19 AC 145 ms
54,220 KB
testcase_20 AC 145 ms
54,288 KB
testcase_21 AC 157 ms
54,228 KB
testcase_22 AC 135 ms
54,172 KB
testcase_23 AC 134 ms
54,216 KB
testcase_24 AC 160 ms
53,912 KB
testcase_25 AC 202 ms
53,996 KB
testcase_26 AC 202 ms
54,184 KB
testcase_27 AC 171 ms
54,164 KB
testcase_28 AC 146 ms
54,112 KB
testcase_29 AC 142 ms
53,880 KB
testcase_30 AC 128 ms
53,052 KB
testcase_31 AC 148 ms
54,152 KB
testcase_32 AC 144 ms
54,344 KB
testcase_33 AC 152 ms
54,384 KB
testcase_34 AC 139 ms
54,280 KB
testcase_35 AC 147 ms
54,164 KB
testcase_36 AC 139 ms
54,036 KB
testcase_37 AC 131 ms
54,252 KB
testcase_38 AC 136 ms
54,340 KB
testcase_39 AC 135 ms
54,304 KB
testcase_40 AC 136 ms
54,252 KB
testcase_41 AC 134 ms
54,156 KB
testcase_42 AC 134 ms
54,088 KB
testcase_43 AC 133 ms
53,876 KB
testcase_44 AC 133 ms
54,076 KB
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

// 

import java.util.*;

public class Main_sol2 {
    private static final int INF = (int)(1e9);
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt(), w = sc.nextInt(), la = sc.nextInt(), lb = sc.nextInt();
        long ka = sc.nextLong(), kb = sc.nextLong();
        sc.close();
        int amx = (h+la-1) / la, bmx = (w+lb-1) / lb, res = INF;
        for (int acnt=0; acnt<=amx; ++acnt) {
            long alen = Math.min(h, acnt*la), adda = acnt * ka;
            int lval = -1, rval = bmx + 1;
            while (rval-lval > 1) {
                int cval = rval - (rval-lval) / 2;
                long blen = Math.min(w, cval*lb), addb = cval * kb;
                if (alen*blen+adda+addb < (long)h*w) lval = cval;
                else rval = cval;
            }
            if (rval <= bmx) res = Math.min(res, acnt+rval);
        }
        System.out.println(res);
    }
}
0