結果

問題 No.2217 Suffix+
ユーザー とりゐとりゐ
提出日時 2023-02-17 21:24:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 226 ms / 2,000 ms
コード長 386 bytes
コンパイル時間 660 ms
コンパイル使用メモリ 86,808 KB
実行使用メモリ 93,076 KB
最終ジャッジ日時 2023-09-26 18:28:54
合計ジャッジ時間 6,417 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,248 KB
testcase_01 AC 70 ms
71,316 KB
testcase_02 AC 70 ms
71,260 KB
testcase_03 AC 70 ms
71,272 KB
testcase_04 AC 71 ms
71,184 KB
testcase_05 AC 72 ms
71,316 KB
testcase_06 AC 73 ms
71,260 KB
testcase_07 AC 72 ms
70,980 KB
testcase_08 AC 73 ms
71,136 KB
testcase_09 AC 71 ms
71,108 KB
testcase_10 AC 73 ms
71,180 KB
testcase_11 AC 73 ms
71,188 KB
testcase_12 AC 72 ms
71,248 KB
testcase_13 AC 72 ms
71,384 KB
testcase_14 AC 87 ms
78,260 KB
testcase_15 AC 90 ms
78,572 KB
testcase_16 AC 98 ms
83,164 KB
testcase_17 AC 94 ms
80,572 KB
testcase_18 AC 88 ms
79,732 KB
testcase_19 AC 153 ms
87,548 KB
testcase_20 AC 148 ms
85,960 KB
testcase_21 AC 94 ms
76,108 KB
testcase_22 AC 152 ms
87,416 KB
testcase_23 AC 142 ms
83,452 KB
testcase_24 AC 115 ms
92,600 KB
testcase_25 AC 114 ms
92,528 KB
testcase_26 AC 113 ms
92,556 KB
testcase_27 AC 112 ms
92,384 KB
testcase_28 AC 113 ms
92,880 KB
testcase_29 AC 191 ms
92,812 KB
testcase_30 AC 192 ms
92,876 KB
testcase_31 AC 190 ms
93,076 KB
testcase_32 AC 192 ms
92,864 KB
testcase_33 AC 192 ms
92,936 KB
testcase_34 AC 114 ms
92,696 KB
testcase_35 AC 73 ms
71,312 KB
testcase_36 AC 226 ms
92,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin
input=lambda :stdin.readline()[:-1]

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

def calc(mid):
  c=0
  num=0
  for i in range(n):
    if a[i]+num<mid:
      use=(mid-a[i]-num+i)//(i+1)
      c+=use
      num+=(i+1)*use
  return c<=k


ng,ok=10**15,-1
while abs(ng-ok)>1:
  mid=(ng+ok)//2
  if calc(mid):
    ok=mid
  else:
    ng=mid

print(ok)
0