結果

問題 No.2217 Suffix+
ユーザー qibqib
提出日時 2023-05-10 22:28:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 247 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 1,379 ms
コンパイル使用メモリ 86,464 KB
実行使用メモリ 93,388 KB
最終ジャッジ日時 2023-08-18 00:52:08
合計ジャッジ時間 9,728 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,164 KB
testcase_01 AC 73 ms
71,272 KB
testcase_02 AC 74 ms
71,292 KB
testcase_03 AC 74 ms
71,356 KB
testcase_04 AC 74 ms
71,284 KB
testcase_05 AC 74 ms
71,272 KB
testcase_06 AC 74 ms
71,320 KB
testcase_07 AC 74 ms
71,280 KB
testcase_08 AC 74 ms
71,356 KB
testcase_09 AC 73 ms
71,112 KB
testcase_10 AC 72 ms
71,312 KB
testcase_11 AC 72 ms
70,980 KB
testcase_12 AC 72 ms
71,276 KB
testcase_13 AC 71 ms
71,136 KB
testcase_14 AC 124 ms
78,544 KB
testcase_15 AC 118 ms
78,608 KB
testcase_16 AC 157 ms
83,444 KB
testcase_17 AC 137 ms
80,464 KB
testcase_18 AC 129 ms
79,620 KB
testcase_19 AC 235 ms
87,468 KB
testcase_20 AC 212 ms
85,804 KB
testcase_21 AC 99 ms
76,356 KB
testcase_22 AC 224 ms
87,504 KB
testcase_23 AC 192 ms
83,608 KB
testcase_24 AC 222 ms
92,876 KB
testcase_25 AC 221 ms
93,304 KB
testcase_26 AC 222 ms
93,332 KB
testcase_27 AC 221 ms
93,248 KB
testcase_28 AC 224 ms
93,036 KB
testcase_29 AC 244 ms
92,956 KB
testcase_30 AC 247 ms
92,936 KB
testcase_31 AC 243 ms
92,960 KB
testcase_32 AC 243 ms
92,932 KB
testcase_33 AC 242 ms
92,956 KB
testcase_34 AC 221 ms
93,388 KB
testcase_35 AC 72 ms
71,032 KB
testcase_36 AC 241 ms
93,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ok = min(a)
ng = 1 << 60
while abs(ok - ng) > 1:
  mid = (ok + ng) // 2

  offset = 0
  cnt = 0
  for i in range(n):
    cost = max(0, (mid - a[i] - offset + i) // (i + 1))
    cnt += cost
    offset += cost * (i + 1)

  if cnt <= k:
    ok = mid
  else:
    ng = mid

print(ok)
0