結果

問題 No.2217 Suffix+
ユーザー lllllll88938494
提出日時 2023-03-30 21:44:49
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 521 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 22,476 KB
最終ジャッジ日時 2024-09-22 07:01:07
合計ジャッジ時間 27,184 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 27 TLE * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

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