結果

問題 No.1808 Fullgold Alchemist
ユーザー ntuda
提出日時 2025-05-12 21:54:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 374 bytes
コンパイル時間 754 ms
コンパイル使用メモリ 82,300 KB
実行使用メモリ 104,464 KB
最終ジャッジ日時 2025-05-12 21:55:03
合計ジャッジ時間 5,141 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
A = list(map(int,input().split()))
suma = sum(A)
lb = 0
ub = suma // M + 1

def check(x):
    tmp = 0
    mx = M * x
    for i in range(N):
        tmp += A[i] - mx
        if tmp < 0:
            return False
    return True

while ub - lb > 1:
    mid = (ub + lb) // 2
    if check(mid):
        lb = mid
    else:
        ub = mid
print(lb)
0