結果

問題 No.2227 King Kraken's Attack
ユーザー buey_tbuey_t
提出日時 2023-02-25 13:31:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 652 ms / 2,000 ms
コード長 1,628 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 82,572 KB
実行使用メモリ 89,456 KB
最終ジャッジ日時 2024-04-10 09:46:42
合計ジャッジ時間 13,889 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
85,524 KB
testcase_01 AC 106 ms
85,392 KB
testcase_02 AC 105 ms
85,480 KB
testcase_03 AC 130 ms
89,088 KB
testcase_04 AC 105 ms
85,344 KB
testcase_05 AC 106 ms
85,324 KB
testcase_06 AC 117 ms
88,976 KB
testcase_07 AC 122 ms
88,996 KB
testcase_08 AC 117 ms
89,236 KB
testcase_09 AC 120 ms
89,172 KB
testcase_10 AC 120 ms
89,208 KB
testcase_11 AC 119 ms
89,100 KB
testcase_12 AC 122 ms
88,940 KB
testcase_13 AC 123 ms
89,148 KB
testcase_14 AC 230 ms
89,136 KB
testcase_15 AC 258 ms
89,056 KB
testcase_16 AC 224 ms
89,044 KB
testcase_17 AC 512 ms
88,968 KB
testcase_18 AC 309 ms
89,224 KB
testcase_19 AC 579 ms
89,140 KB
testcase_20 AC 584 ms
89,040 KB
testcase_21 AC 496 ms
89,076 KB
testcase_22 AC 112 ms
85,344 KB
testcase_23 AC 121 ms
85,532 KB
testcase_24 AC 429 ms
89,148 KB
testcase_25 AC 324 ms
89,344 KB
testcase_26 AC 222 ms
88,804 KB
testcase_27 AC 238 ms
89,068 KB
testcase_28 AC 576 ms
88,896 KB
testcase_29 AC 619 ms
89,180 KB
testcase_30 AC 583 ms
89,012 KB
testcase_31 AC 607 ms
89,208 KB
testcase_32 AC 558 ms
89,448 KB
testcase_33 AC 459 ms
89,328 KB
testcase_34 AC 304 ms
89,456 KB
testcase_35 AC 652 ms
89,352 KB
testcase_36 AC 366 ms
89,432 KB
testcase_37 AC 139 ms
89,104 KB
testcase_38 AC 149 ms
89,156 KB
testcase_39 AC 163 ms
89,064 KB
testcase_40 AC 141 ms
88,836 KB
testcase_41 AC 302 ms
89,288 KB
testcase_42 AC 137 ms
89,084 KB
testcase_43 AC 145 ms
89,160 KB
testcase_44 AC 258 ms
89,196 KB
testcase_45 AC 107 ms
85,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    try:
        import pypyjit
        pypyjit.set_param('max_unroll_recursion=-1')
    except:
        pass
    try:
        import sys
        sys.setrecursionlimit(10**7)
    except:
        pass
    from math import sqrt,sin,cos,tan,ceil,radians,floor,gcd,exp,log,log10,log2,factorial,fsum
    import heapq
    from bisect import bisect_left, bisect_right
    import copy
    from collections import deque,Counter,defaultdict
    from itertools import permutations,combinations
    from decimal import Decimal,ROUND_HALF_UP
    #tmp = Decimal(mid).quantize(Decimal('0'), rounding=ROUND_HALF_UP)
    from functools import lru_cache, reduce
    #@lru_cache(maxsize=None)
    from operator import add,sub,mul,xor,and_,or_
    INF = 10**18
    mod1 = 10**9+7
    mod2 = 998244353
    
    #DecimalならPython
    
    H,W,La,Lb,Ka,Kb = map(int, input().split())
    
    ans = INF
    if Ka == 0 and Kb == 0:
        pass
    elif Ka == 0:
        ans = (H*W+Kb-1)//Kb
    elif Kb == 0:
        ans = (H*W+Ka-1)//Ka
    else:
        ans = min((H*W+Ka-1)//Ka, (H*W+Kb-1)//Kb)

    for i in range(H+1):
        l = 0
        h = W+H+1
        
        tmp = min(i*La,H)
        
        while h-l > 1:
            m = (l+h)//2
            
            if tmp*min(m*Lb,W) + i*Ka + m*Kb >= H*W:
                h = m
            else:
                l = m
        
        
        ans = min(ans, h+i)

    print(ans)
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
if __name__ == '__main__':
    main()
0