結果

問題 No.1808 Fullgold Alchemist
ユーザー H3PO4
提出日時 2022-01-14 21:31:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 321 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 112,384 KB
最終ジャッジ日時 2024-11-20 07:58:30
合計ジャッジ時間 4,843 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
A = tuple(map(int, input().split()))


def isOK(x):
    cur = 0
    for a in A:
        cur += a - x
        if cur < 0:
            return False
    return True


l, r = 0, 10 ** 18
while r - l > 1:
    m = (r + l) // 2
    if isOK(m * M):
        l = m
    else:
        r = m
print(l)
0