結果

問題 No.1808 Fullgold Alchemist
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-01-14 22:37:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 371 bytes
コンパイル時間 830 ms
コンパイル使用メモリ 81,708 KB
実行使用メモリ 104,156 KB
最終ジャッジ日時 2024-11-20 12:50:45
合計ジャッジ時間 4,242 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
A = list(map(int,input().split()))

def calc(x):
    count = 0
    for a in A:
        if a >= x*m:
            count += a-x*m
        else:
            count -= x*m-a
        if count < 0:
            return 0

    return 1
l = 0
r = 10**10
while r > l + 1:
    c = (r+l)//2

    if calc(c):
        l = c
    else:
        r = c

print(l)
0