結果
| 問題 | No.2217 Suffix+ | 
| コンテスト | |
| ユーザー |  310icecrystal | 
| 提出日時 | 2023-06-09 20:52:47 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1,901 ms / 2,000 ms | 
| コード長 | 429 bytes | 
| コンパイル時間 | 425 ms | 
| コンパイル使用メモリ | 82,512 KB | 
| 実行使用メモリ | 93,220 KB | 
| 最終ジャッジ日時 | 2025-01-02 01:24:54 | 
| 合計ジャッジ時間 | 19,877 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 33 | 
ソースコード
N,K = map(int,input().split())
A = [-1] + list(map(int,input().split()))
OK = 0
NG = 10**28 + 1
while NG - OK >= 2:
    MID = (OK + NG) // 2
    count = 0
    now_plus = 0
    for i in range(1,N+1):
        if A[i] + now_plus < MID:
            k = -(-(MID - A[i] - now_plus) // i)
            count += k
            now_plus += i * k
    #print(MID,count)
    if count > K:
        NG = MID
    else:
        OK = MID
print(OK)
            
            
            
        