結果

問題 No.2217 Suffix+
ユーザー ShirotsumeShirotsume
提出日時 2023-02-14 07:13:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 263 ms / 2,000 ms
コード長 646 bytes
コンパイル時間 377 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 93,916 KB
最終ジャッジ日時 2023-09-23 17:18:34
合計ジャッジ時間 9,825 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,508 KB
testcase_01 AC 91 ms
71,380 KB
testcase_02 AC 93 ms
71,512 KB
testcase_03 AC 94 ms
71,584 KB
testcase_04 AC 94 ms
71,516 KB
testcase_05 AC 93 ms
71,500 KB
testcase_06 AC 93 ms
71,500 KB
testcase_07 AC 92 ms
71,348 KB
testcase_08 AC 92 ms
71,396 KB
testcase_09 AC 94 ms
71,380 KB
testcase_10 AC 95 ms
71,376 KB
testcase_11 AC 93 ms
71,416 KB
testcase_12 AC 94 ms
71,292 KB
testcase_13 AC 94 ms
71,520 KB
testcase_14 AC 133 ms
78,972 KB
testcase_15 AC 110 ms
78,832 KB
testcase_16 AC 120 ms
84,476 KB
testcase_17 AC 118 ms
81,512 KB
testcase_18 AC 113 ms
80,564 KB
testcase_19 AC 186 ms
88,528 KB
testcase_20 AC 180 ms
87,244 KB
testcase_21 AC 116 ms
77,072 KB
testcase_22 AC 184 ms
88,476 KB
testcase_23 AC 172 ms
84,412 KB
testcase_24 AC 144 ms
93,512 KB
testcase_25 AC 137 ms
93,484 KB
testcase_26 AC 138 ms
93,916 KB
testcase_27 AC 138 ms
93,412 KB
testcase_28 AC 143 ms
93,612 KB
testcase_29 AC 230 ms
93,312 KB
testcase_30 AC 231 ms
93,224 KB
testcase_31 AC 229 ms
93,272 KB
testcase_32 AC 234 ms
93,224 KB
testcase_33 AC 227 ms
93,464 KB
testcase_34 AC 138 ms
93,560 KB
testcase_35 AC 92 ms
71,600 KB
testcase_36 AC 263 ms
93,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

n, k = mi()

a = li()

def check(x):
    foo = 0
    cnt = 0
    for i in range(n):
        if a[i] + foo < x:
            t = (x - a[i] - foo + i) // (i + 1)
            cnt += t
            foo += (i + 1) * t
    if cnt <= k:
        return True
    else:
        return False

ok = 0

ng = 10 ** 18

while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if check(mid):
        ok = mid
    else:
        ng = mid
print(ok)

0