Submission #7340570


Source Code Expand

Copy
n, a, b = map( int, input().split() )
h = [ int(input()) for _ in range(n) ]

def judge(k):
    _sum = 0
    for hh in h:
        t = hh-k*b
        if t > 0:
            _sum += (t+a-b-1) // (a-b)
            if _sum > k:
                return False;
    return True


high, low = int(1e9+9), 0

while low < high:
    mid = int((high + low) / 2)
    if judge(mid):
        high = mid;
    else:
        low = mid+1;

print(low)

Submission Info

Submission Time
Task D - Widespread
User kira924age
Language Python3 (3.4.3)
Score 400
Code Size 454 Byte
Status
Exec Time 996 ms
Memory 7072 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 a01, a02, a03
All 400 / 400 a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13
Case Name Status Exec Time Memory
a01 17 ms 3064 KB
a02 17 ms 3064 KB
a03 17 ms 3060 KB
b04 17 ms 3064 KB
b05 461 ms 7068 KB
b06 676 ms 7072 KB
b07 701 ms 7068 KB
b08 667 ms 7068 KB
b09 364 ms 7068 KB
b10 412 ms 7064 KB
b11 441 ms 7064 KB
b12 430 ms 7068 KB
b13 996 ms 7072 KB