Submission #31070380


Source Code Expand

n, a, b = map(int, input().split())
h = [int(input()) for i in range(n)]
a -= b
def is_ok(k):
    cnt = 0
    for i in h:
        if i <= b * k:
            continue # 爆発の中心に据えるまでもない魔物は無視
        cnt += (i - b * k + a - 1) // a # 爆発の中心に据えなければならない回数を数える
    if cnt <= k:
        return 1
    else:
        return 0
ok = 10 ** 9
ng = 0
while ok - ng > 1:
    m = (ok + ng) // 2
    if is_ok(m) == 1:
        ok = m
    else:
        ng = m
print(ok)

Submission Info

Submission Time
Task D - Widespread
User Pro_ktmr
Language PyPy3 (7.3.0)
Score 400
Code Size 550 Byte
Status AC
Exec Time 213 ms
Memory 80668 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 13
Set Name Test Cases
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13
Case Name Status Exec Time Memory
a01 AC 63 ms 61796 KiB
a02 AC 51 ms 61704 KiB
a03 AC 54 ms 61528 KiB
b04 AC 53 ms 61696 KiB
b05 AC 189 ms 80308 KiB
b06 AC 213 ms 80536 KiB
b07 AC 194 ms 80508 KiB
b08 AC 195 ms 80668 KiB
b09 AC 184 ms 80488 KiB
b10 AC 176 ms 80604 KiB
b11 AC 178 ms 80548 KiB
b12 AC 182 ms 80544 KiB
b13 AC 204 ms 80596 KiB