Untitled

mail@pastecode.io avatar
unknown
python
19 days ago
448 B
3
Indexable
Never
def getMinimumOperations( executionTime, x, y):
        def check(t):
            cnt = 0
            for v in executionTime:
                if v > t * y:
                    cnt += math.ceil((v - t * y) / (x - y))
            return cnt <= t

        l, r = 0, max(executionTime)
        while l < r:
            mid = (l + r) >> 1
            if check(mid):
                r = mid
            else:
                l = mid + 1
        return l
Leave a Comment