結果

問題 No.2217 Suffix+
ユーザー meruuu61779999meruuu61779999
提出日時 2023-02-17 21:39:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 263 ms / 2,000 ms
コード長 970 bytes
コンパイル時間 1,000 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 91,624 KB
最終ジャッジ日時 2023-09-26 18:53:27
合計ジャッジ時間 7,290 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,344 KB
testcase_01 AC 74 ms
71,340 KB
testcase_02 AC 75 ms
71,140 KB
testcase_03 AC 74 ms
71,136 KB
testcase_04 AC 74 ms
71,324 KB
testcase_05 AC 73 ms
71,204 KB
testcase_06 AC 74 ms
71,044 KB
testcase_07 AC 73 ms
71,300 KB
testcase_08 AC 73 ms
71,096 KB
testcase_09 AC 73 ms
71,196 KB
testcase_10 AC 73 ms
71,200 KB
testcase_11 AC 73 ms
71,264 KB
testcase_12 AC 74 ms
71,264 KB
testcase_13 AC 72 ms
71,300 KB
testcase_14 AC 82 ms
77,904 KB
testcase_15 AC 85 ms
78,224 KB
testcase_16 AC 90 ms
82,560 KB
testcase_17 AC 85 ms
80,268 KB
testcase_18 AC 85 ms
79,468 KB
testcase_19 AC 135 ms
87,044 KB
testcase_20 AC 137 ms
85,576 KB
testcase_21 AC 88 ms
76,180 KB
testcase_22 AC 136 ms
86,968 KB
testcase_23 AC 131 ms
83,312 KB
testcase_24 AC 112 ms
91,264 KB
testcase_25 AC 109 ms
90,892 KB
testcase_26 AC 108 ms
90,888 KB
testcase_27 AC 111 ms
91,184 KB
testcase_28 AC 110 ms
91,280 KB
testcase_29 AC 226 ms
91,508 KB
testcase_30 AC 226 ms
91,500 KB
testcase_31 AC 226 ms
91,576 KB
testcase_32 AC 226 ms
91,624 KB
testcase_33 AC 225 ms
91,536 KB
testcase_34 AC 108 ms
91,412 KB
testcase_35 AC 73 ms
71,136 KB
testcase_36 AC 263 ms
91,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

inputs = sys.stdin.readline

"""再帰関数のときセット
sys.setrecursionlimit(10**7)
import pypyjit
pypyjit.set_param('max_unroll_recursion=-1')
"""


def main():
    N, K = map(int, inputs().split())
    A = list(map(int, inputs().split()))

    def judge(m):
        cnt = 0
        power = 0
        for i, a in enumerate(A):
            if cnt > K:
                break
            now_val = a + power
            if now_val < m:
                pl_cnt = (m - now_val) // (i + 1)
                if (m - now_val) % (i + 1):
                    pl_cnt += 1
                cnt += pl_cnt
                power += pl_cnt * (i + 1)
        return cnt <= K

    left, right = 0, 10 ** 15
    while right - left >= 2:
        mid = (left + right) // 2
        if judge(mid):
            left = mid
        else:
            right = mid - 1
    if judge(right):
        print(right)
    else:
        print(left)


if __name__ == '__main__':
    main()
0