結果
| 問題 | No.2217 Suffix+ | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-02-17 21:32:32 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 235 ms / 2,000 ms | 
| コード長 | 558 bytes | 
| コンパイル時間 | 222 ms | 
| コンパイル使用メモリ | 82,176 KB | 
| 実行使用メモリ | 92,288 KB | 
| 最終ジャッジ日時 | 2024-07-19 12:36:17 | 
| 合計ジャッジ時間 | 5,188 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 33 | 
ソースコード
import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd
n,k = map(int,input().split())
a =[0] + list(map(int,input().split()))
l = 0
r = 10**18
while r-l > 1:
  m = (r+l)//2
  cnt = 0
  now = 0
  for i in range(1, n+1):
    if a[i] + now < m:
      dif = m - (a[i] + now)
      tmp = (dif+i-1)//i
      cnt += tmp
      now += tmp * i
  if cnt <= k:
    l = m
  else:
    r = m
  
print(l)
            
            
            
        