結果

問題 No.1808 Fullgold Alchemist
ユーザー Shirotsume
提出日時 2022-01-14 22:20:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 166 ms / 2,000 ms
コード長 417 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 82,732 KB
実行使用メモリ 151,680 KB
最終ジャッジ日時 2024-11-20 11:37:52
合計ジャッジ時間 4,961 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int,input().split())
a = list(map(int,input().split()))
import copy
def check(x, a):
    for i in range(n):
        if a[i] < m * x:
            return False
        elif i < n - 1:
            a[i + 1] += a[i] - m * x
    return True

ok = 0
ng = 10 ** 9 + 3

while abs(ok - ng) > 1:
    A = copy.copy(a)
    mid = (ok + ng) // 2
    if check(mid, A):
        ok = mid
    else:
        ng = mid
print(ok)
0