結果

問題 No.2227 King Kraken's Attack
ユーザー 👑 KazunKazun
提出日時 2023-02-24 22:27:59
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 981 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 82,140 KB
実行使用メモリ 76,328 KB
最終ジャッジ日時 2024-04-10 09:31:11
合計ジャッジ時間 13,048 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,540 KB
testcase_01 AC 38 ms
52,988 KB
testcase_02 AC 39 ms
52,708 KB
testcase_03 AC 54 ms
67,124 KB
testcase_04 AC 39 ms
53,476 KB
testcase_05 AC 37 ms
52,604 KB
testcase_06 AC 38 ms
53,256 KB
testcase_07 AC 46 ms
63,896 KB
testcase_08 AC 38 ms
53,380 KB
testcase_09 AC 51 ms
64,776 KB
testcase_10 AC 43 ms
59,752 KB
testcase_11 AC 49 ms
64,748 KB
testcase_12 AC 51 ms
64,972 KB
testcase_13 AC 53 ms
66,604 KB
testcase_14 AC 59 ms
75,196 KB
testcase_15 AC 255 ms
75,492 KB
testcase_16 AC 62 ms
75,360 KB
testcase_17 AC 640 ms
75,604 KB
testcase_18 AC 64 ms
74,968 KB
testcase_19 AC 448 ms
75,536 KB
testcase_20 AC 448 ms
75,432 KB
testcase_21 AC 840 ms
76,108 KB
testcase_22 AC 36 ms
52,676 KB
testcase_23 AC 36 ms
52,064 KB
testcase_24 AC 401 ms
75,784 KB
testcase_25 AC 270 ms
75,368 KB
testcase_26 AC 61 ms
75,300 KB
testcase_27 AC 76 ms
74,920 KB
testcase_28 AC 990 ms
76,112 KB
testcase_29 AC 968 ms
75,872 KB
testcase_30 AC 974 ms
76,208 KB
testcase_31 AC 937 ms
76,328 KB
testcase_32 AC 857 ms
75,888 KB
testcase_33 AC 542 ms
76,184 KB
testcase_34 AC 323 ms
76,196 KB
testcase_35 AC 784 ms
76,324 KB
testcase_36 AC 420 ms
75,692 KB
testcase_37 AC 49 ms
64,640 KB
testcase_38 AC 49 ms
66,288 KB
testcase_39 AC 52 ms
68,736 KB
testcase_40 AC 49 ms
65,456 KB
testcase_41 AC 62 ms
75,592 KB
testcase_42 AC 49 ms
64,396 KB
testcase_43 AC 49 ms
65,624 KB
testcase_44 AC 59 ms
73,092 KB
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def General_Binary_Increase_Search_Integer(L, R, cond, default=None):
    """ 条件式が単調増加であるとき, 整数上で二部探索を行う.

    L: 解の下限
    R: 解の上限
    cond: 条件(1変数関数, 広義単調増加を満たす)
    default: Lで条件を満たさないときの返り値
    """

    if not(cond(R)):
        return default

    if cond(L):
        return L

    R+=1
    while R-L>1:
        C=L+(R-L)//2
        if cond(C):
            R=C
        else:
            L=C
    return R

#==================================================
def solve():
    H,W,LA,LB,KA,KB=map(int,input().split())

    inf=float("inf")
    X=inf
    for A in range(H+1):
        def check(b):
            s=min(H,A*LA)
            t=min(W,b*LB)
            return s*t+A*KA+b*KB>=H*W

        B=General_Binary_Increase_Search_Integer(0,H+W,check,inf)
        X=min(X,A+B)
    return X
#==================================================
print(solve())
0