結果

問題 No.2227 King Kraken's Attack
ユーザー mkawa2mkawa2
提出日時 2023-02-24 21:58:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 727 ms / 2,000 ms
コード長 1,165 bytes
コンパイル時間 338 ms
コンパイル使用メモリ 82,376 KB
実行使用メモリ 76,076 KB
最終ジャッジ日時 2024-04-10 09:20:42
合計ジャッジ時間 7,100 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,076 KB
testcase_01 AC 36 ms
53,540 KB
testcase_02 AC 35 ms
52,824 KB
testcase_03 AC 56 ms
68,056 KB
testcase_04 AC 35 ms
53,076 KB
testcase_05 AC 37 ms
52,340 KB
testcase_06 AC 48 ms
63,816 KB
testcase_07 AC 46 ms
62,112 KB
testcase_08 AC 48 ms
61,308 KB
testcase_09 AC 51 ms
66,204 KB
testcase_10 AC 49 ms
64,388 KB
testcase_11 AC 41 ms
59,976 KB
testcase_12 AC 43 ms
61,036 KB
testcase_13 AC 44 ms
60,824 KB
testcase_14 AC 268 ms
75,600 KB
testcase_15 AC 156 ms
75,440 KB
testcase_16 AC 160 ms
75,488 KB
testcase_17 AC 727 ms
75,916 KB
testcase_18 AC 550 ms
75,540 KB
testcase_19 AC 65 ms
75,624 KB
testcase_20 AC 66 ms
75,468 KB
testcase_21 AC 132 ms
75,800 KB
testcase_22 AC 177 ms
75,864 KB
testcase_23 AC 64 ms
75,808 KB
testcase_24 AC 114 ms
75,780 KB
testcase_25 AC 564 ms
75,596 KB
testcase_26 AC 321 ms
75,704 KB
testcase_27 AC 320 ms
75,348 KB
testcase_28 AC 82 ms
75,824 KB
testcase_29 AC 70 ms
75,716 KB
testcase_30 AC 267 ms
75,860 KB
testcase_31 AC 80 ms
76,076 KB
testcase_32 AC 77 ms
75,804 KB
testcase_33 AC 71 ms
75,608 KB
testcase_34 AC 65 ms
73,816 KB
testcase_35 AC 78 ms
75,684 KB
testcase_36 AC 69 ms
75,584 KB
testcase_37 AC 36 ms
53,028 KB
testcase_38 AC 36 ms
53,280 KB
testcase_39 AC 36 ms
53,560 KB
testcase_40 AC 36 ms
53,928 KB
testcase_41 AC 36 ms
52,960 KB
testcase_42 AC 37 ms
53,852 KB
testcase_43 AC 37 ms
53,004 KB
testcase_44 AC 36 ms
52,264 KB
testcase_45 AC 36 ms
54,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# inf = (1 << 31)-1
md = 10**9+7
# md = 998244353

def binary_search(l, r, minimize):
    if minimize: l -= 1
    else: r += 1
    while l+1 < r:
        m = (l+r)//2
        if ok(m) ^ minimize: l = m
        else: r = m
    if minimize: return r
    return l

def ok(b):
    return min(a*la, h)*min(w, b*lb)+a*ka+b*kb >= h*w

h, w, la, lb, ka, kb = LI()

mx = (h+la-1)//la+(w+lb-1)//lb
ans = inf
for a in range(mx+1):
    b = binary_search(0, mx, True)
    ans = min(ans, a+b)

print(ans)
0