結果

問題 No.2217 Suffix+
ユーザー lloyzlloyz
提出日時 2023-02-17 23:29:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 220 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 493 ms
コンパイル使用メモリ 87,052 KB
実行使用メモリ 93,332 KB
最終ジャッジ日時 2023-09-26 20:52:05
合計ジャッジ時間 6,478 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,284 KB
testcase_01 AC 67 ms
71,244 KB
testcase_02 AC 67 ms
71,324 KB
testcase_03 AC 70 ms
71,252 KB
testcase_04 AC 69 ms
71,184 KB
testcase_05 AC 71 ms
71,312 KB
testcase_06 AC 69 ms
71,248 KB
testcase_07 AC 69 ms
71,380 KB
testcase_08 AC 69 ms
71,076 KB
testcase_09 AC 68 ms
71,300 KB
testcase_10 AC 69 ms
71,208 KB
testcase_11 AC 68 ms
71,292 KB
testcase_12 AC 70 ms
71,200 KB
testcase_13 AC 68 ms
71,380 KB
testcase_14 AC 86 ms
78,584 KB
testcase_15 AC 85 ms
78,560 KB
testcase_16 AC 93 ms
83,436 KB
testcase_17 AC 89 ms
80,656 KB
testcase_18 AC 87 ms
79,948 KB
testcase_19 AC 155 ms
87,780 KB
testcase_20 AC 151 ms
86,136 KB
testcase_21 AC 96 ms
76,128 KB
testcase_22 AC 160 ms
87,480 KB
testcase_23 AC 145 ms
83,404 KB
testcase_24 AC 113 ms
92,512 KB
testcase_25 AC 119 ms
92,644 KB
testcase_26 AC 112 ms
92,748 KB
testcase_27 AC 111 ms
92,880 KB
testcase_28 AC 112 ms
92,952 KB
testcase_29 AC 193 ms
93,164 KB
testcase_30 AC 193 ms
93,100 KB
testcase_31 AC 193 ms
93,280 KB
testcase_32 AC 189 ms
93,276 KB
testcase_33 AC 195 ms
93,172 KB
testcase_34 AC 113 ms
93,132 KB
testcase_35 AC 69 ms
70,988 KB
testcase_36 AC 220 ms
93,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

left, right = -1, 10**15
while right - left > 1:
    mid = (left + right) // 2
    res = 0
    cnt = 0
    for i in range(n):
        ai = A[i] + res
        if ai >= mid:
            continue
        tmp = (mid - ai + i) // (i + 1)
        cnt += tmp
        res += tmp * (i + 1)
    if cnt <= k:
        left = mid
    else:
        right = mid
print(left)
0