結果

問題 No.2217 Suffix+
コンテスト
ユーザー lllllll88938494
提出日時 2023-03-30 21:45:57
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 130 ms / 2,000 ms
コード長 521 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 123 ms
コンパイル使用メモリ 85,120 KB
実行使用メモリ 96,772 KB
最終ジャッジ日時 2026-04-10 12:52:45
合計ジャッジ時間 3,465 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n,k=map(int,input().split())
a=list(map(int,input().split()))

def  cal(x):
    cnt = 0
    now = 0
    for i in range(n):
        if now + a[i] < x:
            t=now + a[i]
            v,m=divmod(x-t,i+1)
            if m>0:
                v+=1
            cnt += v
            now += v * (i+1)

    # print(cnt,x)
    if cnt <= k:
        return True
    else:
        return False

ok = 0
ng = 10 ** 15
while ng - ok > 1:

    mid = (ng+ok)//2
    if cal(mid):
        ok = mid
    else:
        ng = mid

print(ok)
0