結果

問題 No.2227 King Kraken's Attack
ユーザー 👑 KazunKazun
提出日時 2023-02-24 22:25:06
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 983 bytes
コンパイル時間 325 ms
コンパイル使用メモリ 82,536 KB
実行使用メモリ 76,112 KB
最終ジャッジ日時 2024-04-10 09:30:05
合計ジャッジ時間 23,522 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,620 KB
testcase_01 AC 35 ms
53,004 KB
testcase_02 AC 37 ms
53,488 KB
testcase_03 AC 57 ms
69,500 KB
testcase_04 AC 37 ms
52,332 KB
testcase_05 AC 34 ms
52,812 KB
testcase_06 AC 37 ms
53,968 KB
testcase_07 AC 48 ms
65,132 KB
testcase_08 AC 36 ms
53,936 KB
testcase_09 AC 55 ms
67,268 KB
testcase_10 AC 41 ms
59,644 KB
testcase_11 AC 51 ms
65,576 KB
testcase_12 AC 53 ms
67,744 KB
testcase_13 AC 56 ms
69,956 KB
testcase_14 AC 62 ms
75,552 KB
testcase_15 AC 607 ms
75,444 KB
testcase_16 AC 63 ms
75,264 KB
testcase_17 AC 1,099 ms
75,804 KB
testcase_18 AC 114 ms
75,536 KB
testcase_19 AC 471 ms
75,620 KB
testcase_20 AC 1,577 ms
75,620 KB
testcase_21 AC 1,549 ms
75,996 KB
testcase_22 AC 37 ms
52,524 KB
testcase_23 AC 39 ms
53,224 KB
testcase_24 AC 1,469 ms
75,820 KB
testcase_25 AC 1,649 ms
75,780 KB
testcase_26 AC 65 ms
75,492 KB
testcase_27 AC 134 ms
75,884 KB
testcase_28 AC 1,663 ms
76,112 KB
testcase_29 AC 1,699 ms
75,940 KB
testcase_30 AC 1,775 ms
75,644 KB
testcase_31 AC 1,660 ms
75,728 KB
testcase_32 AC 1,288 ms
75,776 KB
testcase_33 AC 906 ms
75,640 KB
testcase_34 AC 511 ms
75,796 KB
testcase_35 AC 1,372 ms
75,576 KB
testcase_36 AC 665 ms
75,936 KB
testcase_37 AC 69 ms
75,356 KB
testcase_38 AC 75 ms
75,804 KB
testcase_39 AC 79 ms
75,532 KB
testcase_40 AC 70 ms
75,284 KB
testcase_41 AC 113 ms
75,268 KB
testcase_42 AC 67 ms
75,284 KB
testcase_43 AC 67 ms
75,168 KB
testcase_44 AC 103 ms
75,448 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+1,check,inf)
        X=min(X,A+B)
    return X
#==================================================
print(solve())
0