結果
| 問題 | No.2217 Suffix+ | 
| コンテスト | |
| ユーザー |  lllllll88938494 | 
| 提出日時 | 2023-03-30 21:45:57 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 269 ms / 2,000 ms | 
| コード長 | 521 bytes | 
| コンパイル時間 | 174 ms | 
| コンパイル使用メモリ | 82,280 KB | 
| 実行使用メモリ | 92,200 KB | 
| 最終ジャッジ日時 | 2024-09-22 07:01:14 | 
| 合計ジャッジ時間 | 4,613 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 33 | 
ソースコード
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)
            
            
            
        