complete 28357.py
This commit is contained in:
19
zeta_python/completed/28357.py
Normal file
19
zeta_python/completed/28357.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
def X(N, K, A) -> int:
|
||||||
|
A.sort()
|
||||||
|
start = 0
|
||||||
|
end = max(A)
|
||||||
|
mid = start
|
||||||
|
while start < end:
|
||||||
|
mid = (start + end) // 2
|
||||||
|
w = sum(x - mid for x in A if x > mid)
|
||||||
|
if w > K:
|
||||||
|
start = mid + 1
|
||||||
|
else:
|
||||||
|
end = mid
|
||||||
|
return start
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
N, K = map(int, input().split())
|
||||||
|
A = list(map(int, input().split()))
|
||||||
|
print(X(N, K, A))
|
||||||
Reference in New Issue
Block a user