結果

問題 No.1808 Fullgold Alchemist
ユーザー kohei2019kohei2019
提出日時 2023-06-15 00:01:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 475 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 82,180 KB
実行使用メモリ 102,400 KB
最終ジャッジ日時 2024-06-23 04:52:43
合計ジャッジ時間 5,003 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
lsA = list(map(int,input().split()))
# 鉱石をならす
def is_ok(arg):
    rem = 0
    for i in range(N):
        if lsA[i]+rem>=M*arg:
            rem = lsA[i]+rem-M*arg
        else:
            return False
    return True
 
 
def meguru_bisect(ng, ok):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok
print(meguru_bisect(10**18+1,0))
0