結果

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

ソースコード

diff #

n, m = map(int, input().split())
a = list(map(int, input().split()))
l = 0
r = 10 ** 9 + 1
while r - l > 1:
    c = (l + r) // 2
    carry = 0
    for x in a:
        x += carry
        if x < m * c:
            break
        carry = x - m * c
    else:
        l = c
        continue
    r = c
print(l)
0